其他分享
首页 > 其他分享> > 15 呈现数据

15 呈现数据

作者:互联网

15.1 理解输入输出

 在显示器屏幕上显示输出
 将输出重定向到文件中

15 呈现数据

1只重定向错误
la badfile 2> test1
2重定向错误和数据
la test1 badfile 2> test2 1> test3
la test1 badfile &> test2

脚本中重定向(如果追加使用>>):
echo "error" >&2

exec 0< input
exec 1> output
exec 2> error.output

创建自己的重定向:
exec 3> test.out
echo "test" >&3

创建读写文件符号(要小心,不容易使用)
exec 3<> testfile

关闭文件描述符:
exec 3>&-

创建临时文件/目录:
mktemp test.XXXXXX
mktemp -d test.dir.XXXXXX

管道的T型接口:
date | tee output

标签:test1,test2,15,重定向,exec,badfile,呈现,test,数据
来源: https://blog.51cto.com/13690643/2539123