在學習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.
-un-
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'' .)