4

Is typescript for script command the same as TypeScript maintained by Microsoft? How to print using ldr ?

What exactly is typescript in relation to Linux/Ubuntu ?

Searching Google, I find that TypeScript is a superset of Javascript maintained by Microsoft. Is the output of script stored using this format?

I see that the output of script is binary.

How do I print a typescript file using ldr command ?

2 Answers 2

6

They are totally unrelated. Microsoft TypeScript is a programming language while under Unix and Linux typescript is the default output of the script command which is logging everything printed in you terminal session.

Don't be fooled by the binary status reported by file, it is due to embedded escape sequences. The better way to display typescript files is using the less -r command which preserves formatting/color commands that might be present in the file.

8
  • If this is ASCII, why does my Linux Mint display and icon that symbols a binary file and a file editor like gedit cannot display all characters in it ?
    – Shuzheng
    Aug 16, 2015 at 8:55
  • Because it is not just simple ascii, programs can output anything, especially when you use a non English locale.
    – jlliagre
    Aug 16, 2015 at 8:56
  • How do I print this file output by script with the binary (non-ASCII) translated correctly, using lpr ?
    – Shuzheng
    Aug 16, 2015 at 9:00
  • The man page says script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive ses‐ sion as proof of an assignment, as the typescript file can be printed out later with lpr(1). You can print it directly with lpr command, no additional editing necessary Aug 16, 2015 at 9:11
  • @jlliagre You wrote: Don't be fooled by the binary status reported by file . Does your file command report output of script as binary ? Because mine doesn't , only ASCII text Aug 16, 2015 at 9:13
5

Take a look at the man script:

SYNOPSIS

 script [-a] [-c command] [-e] [-f] [-q] [-t[=file]] [-V] [-h] [file]

Notice that last [file] part. By default, if you simply run script without specifying where to store the file, it will save everything to a file called typescript. By contrast, if you run script somefilename everything will be saved to somefilename.

Now if we run file command on typescript to determine the file's type, we get this:

$ file typescript                                                                                                                                     
typescript: ASCII text, with CRLF, CR, LF line terminators, with escape sequences, with overstriking 

As you can see, you've got simple text document there that is in no way related to Microsoft's TypeScript. Even more so, since this is a simple text document you should be able to print it with lpr command easily.

Word of caution though, if you have output of ls --color -F there, you might run into trouble, because ls adds special characters to colorize the files based on their type. Thus using simple \ls or dir is recommended

7
  • Ohh... so typescript refers to the default name of file and not the type/format of file ?
    – Shuzheng
    Aug 16, 2015 at 8:51
  • @NicolasLykkeIversen yes, it's just default filename. Not related to java at all Aug 16, 2015 at 8:59
  • 1
    @Serg TypeScript has no relation to Java too of course! Aug 16, 2015 at 11:53
  • @SergiyKolodyazhnyy As the filetype is ASCII text, how does script command stores color information?
    – Porcupine
    Jun 12, 2018 at 14:57
  • 1
    @Nikhil It doesn't. It stores escape sequences, which then are interpreted by terminal and subsequent characters are colorized Jun 12, 2018 at 15:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .