Printing and Scripting Files

To print the file from the console, use the lpr command.

lpr [-Pprinter] [-#num] [-cdfghlnmprstv] [name ...]

Lpr uses a spooling daemon to print the named files when facilities become available. If no names appear, the standard input is assumed. For example if you wish to print the file "" at lab 114, At the prompt type,

<machine>% lpr -Php114

The hp114 is the printer name and it varies with the lab. The following single letter options are used to notify the line printer spooler that the files are not standard text files. The spooling daemon will use the appropriate filters to print the data accordingly.

-f Use a filter which interprets the first character of each line as a standard FORTRAN carriage control character.

-g The files are assumed to contain standard plot data as produced by the plot routines (see also plot for the filters used by the printer spooler).

-l Use a filter which allows control characters to be printed and suppresses page breaks.

These options apply to the handling of the print job:

-P Force output to a specific printer. Normally, the default print- er is used (site dependent), or the value of the environment variable PRINTER is used.

The remaining options apply to copies, the page display, and headers:

-#num The quantity num is the number of copies desired of each file named. For example,

<machine>% lpr -Php114 #3

would result in 3 copies of the file, followed by 3 copies of the file, etc. On the other hand,

<machine>% cat| lpr -Php114 #3

will give three copies of the concatenation of the files.


Script is a program in unix that records everything, you display on your screen during a session. You should not start a script session while you are already running one. To start a script session, simply use the command:

<machine>% script script_file_name

where script_file_name is the name of the file you want the content to go to. The default file name the script program uses is "typescript". So if you just start script without specifying the file name, the data goes to this file. Do NOT give your script the same name of existing file(absolutely not you program name). If you use an existing filename the script will overwrite on the file. So best is to assign them seperate extensions. Say for example, if you want to script lab1.c 's output, one suggestion is to keep the script name as "lab1.script". If you wish to append to an existing script file, Type

<machine>% script -a lab1.script

will start a script session, and add it to the end of the file `assign1.script'.
To exit a script session, type exit or press "CTRL"-d. When you exit from script, you'll see a message like the this:
<machine>% exit
Script done, file is assign1.script

<machine>% script lab1.script
Script started, file is lab1.script
<machine>% echo "This is a test for scripting the files"
This is a test for scripting the files
<machine>% Script done, file is lab1.script
The session was close by using "CTRL-d". To append to the same file .
<machine>% script -a lab1.script
Script started, file is lab1.script
<machine>% echo I m appending to the script
I m appending to the script
<machine>% exit
<machine>% Script done, file is lab1.script