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'' .)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值