注:本文由本人最早发布在 http://roland.blog.51cto.com/(Roland技术窝~~),现逐步将原 http://roland.blog.51cto.com/(Roland技术窝~~) 所有文章迁移至此博客,请勿修改“创作类型”!致谢!
Redirector Function
译:重定向功能(函数)
cmd1 | cmd2
Pipe; take standard output of cmd1 as standard input to cmd2
译:管道;cmd2的标准输入接收自cmd1的标准输出
> file
Direct standard output to file
译:直接将标准输出到file
< file
Take standard input from file
译:接收来自file的标准输入
>> file
Direct standard output to file; append to file if it already exists
译:直接将标准输出到file;如果file存在则附加在其文件末尾
>| file
Force standard output to file even if noclobber is set
译:强制标准输出到file
n>| file
Force output to file from file descriptor n even if noclobber is set
译:强制文件描述符n的输出重定向到file
<> file
Use file as both standard input and standard output
译:使file即为标准输入又是标准输出(以读写方式打开file)
n<> file
Use file as both input and output for file descriptor n
译:使文件名描述符n的输入和输出均定向到file(以读写方式打开file)
<< label
Here-document; see text
注: lable为输入结束标签,支持多行输入(一般定义为EOF)
n> file
Direct file descriptor n to file
译:直接将文件描述符n输出到file
n< file
Take file descriptor n from file
译:文件描述符n输入来自file
n>> file
Direct file descriptor n to file; append to file if it already exists
译:直接将文件描述服n输出到file;如果file存在则在其末尾附加
n>&
Duplicate standard output to file descriptor n
译:将标准输出(&1)的地址复制给文件描述符n(n=&1)
n<&
Duplicate standard input from file descriptor n
译:将标准输入(&0)的地址复制给文件描述符n(n=&0)
n>&m
File descriptor n is made to be a copy of the output file descriptor
译:将文件描述服m的地址复制给文件描述符n做为输出(n stdout=m stdout)
n<&m
File descriptor n is made to be a copy of the input file descriptor
译:将文件描述符m的地址复制给文件描述符n作为输入(m stdin=m stdin)
&>file
Directs standard output and standard error to file
译:直接将标准输出和标准错误信息输出到文件(1>file 2>&1)
<&-
Close the standard input
译:关闭标准输入
>&-
Close the standard output
译:关闭标准输出
n>&-
Close the output from file descriptor n
译:关闭文件描述符n的标准输出(n stdout = NULL)
n<&-
Close the input from file descriptor n
译:关闭文件描述符n的标准输入(n stdin = NULL)
转载于:https://blog.51cto.com/rolandqu/942406