美文网首页
shell-重定向

shell-重定向

作者: 哆来咪发都不会 | 来源:发表于2019-08-13 18:36 被阅读0次
>: 重写(正确信息)
>>: 追加(正确信息)
2>: 重写(错误信息)
2>>: 追加(错误信息)
&>: 重写(全部信息)
&>>: 追加(全部信息)
实例
[root@localhost wang]# ls
123.txt  1.txt  23.txt  2.txt  3.txt  a.txt  A.txt
[root@localhost wang]# ls 123.txt >test.txt
[root@localhost wang]# cat test.txt 
123.txt
[root@localhost wang]# ls 2.txt >test.txt 
[root@localhost wang]# cat test.txt 
2.txt
[root@localhost wang]# ls a.txt >>test.txt 
[root@localhost wang]# cat test.txt 
2.txt
a.txt
[root@localhost wang]# ls h.txt 2>test.txt 
[root@localhost wang]# cat test.txt 
ls: 无法访问h.txt: 没有那个文件或目录
[root@localhost wang]# ls hahah.txt 2>>test.txt 
[root@localhost wang]# cat test.txt 
ls: 无法访问h.txt: 没有那个文件或目录
ls: 无法访问hahah.txt: 没有那个文件或目录
[root@localhost wang]# ls a.txt h.txt 1.txt &> test.txt 
[root@localhost wang]# cat test.txt 
ls: 无法访问h.txt: 没有那个文件或目录
1.txt
a.txt
[root@localhost wang]# 

相关文章

  • shell-重定向

    实例

  • shell-输入输出重定向

    输出重定向 命令的输出不仅可以是显示器,还可以很容易的转移向到文件,这被称为输出重定向。命令输出重定向的语法为: ...

  • Jenkins脚本上传文件到SVN

    直接上例子1.构建->增加构建步骤->执行shell-复制粘贴->根据自身的需求做相关更改即可

  • 第07章重定向管道

    输出重定向案例 > < 脚本中使用重定向 2.输入重定向及结合案例 管道 | 重定向和管道的符号对比。重定向输出到...

  • shell 笔记 Day1

    重定向: (覆盖重定向), >>(追加重定向) , 2>(重定向错误信息) , &>(错误正确都重定...

  • 《Linux就该这么学 》笔记(六)| 管道符、重定向和环境变量

    1. 重定向 重定向技术的 5 种模式 标准覆盖输出重定向 标准追加输出重定向 错误覆盖输出重定向 错误追加输出重...

  • 永久性重定向和302临时性重定向

    什么是重定向? 所谓重定向就是将网页自动转向重定向,即:301永久性重定向和302临时性重定向。实施301后,新网...

  • 2019-06-13 重定向301和302

    什么是重定向? 所谓重定向就是将网页自动转向重定向,即:301永久性重定向和302临时性重定向。实施301后,新网...

  • 重定向

    输出重定向 输入重定向 错误重定向 管道 shell中特殊符号

  • Linux重定向day13

    1.重定向概述2.重定向的输出输入3.进程管道技术 一、重定向概述 什么是重定向:Linux重定向是指修改原来默认...

网友评论

      本文标题:shell-重定向

      本文链接:https://www.haomeiwen.com/subject/xrobjctx.html