The Korn shell provides a number of input/output commands, which are covered in the following sections.
You've already seen this command a hundred times since it was introduced in Chapter 3, but here it is again. This is a more formal definition of the command that describes the other things it can be used for. The print command displays arguments according to options with this format:
print [options] arguments
Without options, special characters, or quotes, each argument is displayed separated with a space, and all the arguments are terminated with a newline:
$ print X Y Z X Y Z
Notice that all the extra whitespace between the arguments was truncated. We could keep the whitespace by enclosing the arguments in quotes like this:
$ print "X Y Z" X Y Z
There are a number of special escape characters that allow you to format the print arguments. For example, to display arguments on separate lines, instead of using multiple print commands:
$ print X; print Y; print Z X Y Z
the arguments could be separated with the newline escape character :
$ print "X Y Z" X Y Z
a | bell character |
backspace | |
c | line without ending newline (remaining arguments ignored) |
f | formfeed |
newline | |
return | |
tab | |
v | vertical tab |
\ | backslash |