The print command (Korn shell only)

在学习co-process时,用到print -p $var  来进行通信,当时不太理解这个~~

In the Korn shell, print is preferred to echo . print is built in to the shell and behaves just like echo and recognizes the same escape commands. It also accepts the following options:


-
Anything following the - is processed as an argument, even if it begins with a -.

-R
The escape conventions (commands beginning with /) are ignored. Anything following the -R (except a -n ) is treated as an argument, even if it begins with a ``-''.

-n
print does not append a newline to its output.

-p
If you have started a co-process running with the |& command (see ``More about redirecting input and output'' ), the -p flag makes print send its output to the co-process via a pipe.

-r
print ignores the - escape commands and prints their literal value (that is, a backslash followed by the escape command letter).

-s
print sends its output to the history file. This enables you to add commands to your history file from a shell script without executing them; you can subsequently recall or edit them rapidly, without needing to re-type them.

-u n
print sends its output to file descriptor n .

The -u option is equivalent to redirecting the standard output, but doesn't open or close the destination file. This is particularly useful if you have opened some files in ksh and want to write data to them (for later reading with the read command); see ``More about redirecting input and output'' .)

你可能感兴趣的:(shell,command,input,Descriptor,output,newline)