The print command (Korn shell only)

来源:互联网 发布:leap计算软件 编辑:程序博客网 时间:2024/06/05 20:43

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


In the Korn shell, print is preferred toecho. print is built in to the shell and behavesjust like echo and recognizes the same escape commands. Italso accepts the following options:


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

-R
The escape conventions (commands beginning with /) areignored. 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 theco-process via a pipe.

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

-s
print sends its output to the history file. This enablesyou to add commands to your history file from a shell script withoutexecuting 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 standardoutput, but doesn't open or close the destination file. This isparticularly useful if you have opened some files in kshand want to write data to them (for later reading with theread command); see``More about redirecting input and output''.)

原创粉丝点击