LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1206|回复: 4

请谁解释一下>a.txt<b.txt cat是怎么运行的?

[复制链接]
发表于 2003-10-19 18:13:35 | 显示全部楼层 |阅读模式
总是没想明白,哪位能解释一下吗?
  另外怎么样在机子里查看shell的命令帮助?
  谢谢!
发表于 2003-10-19 18:27:18 | 显示全部楼层
1,>(重定向输出符)a.txt是生成一个空文件a.txt,然后用<(重定向输入符)把b.txt的内容作为输入输入到a.txt文件中.
2,shell的帮助可以这样:man bash
 楼主| 发表于 2003-10-19 18:40:43 | 显示全部楼层

那怎么cat要在后面呢?

怎么后面改成<cat a.txt就不对了?这样想起来好象更合理啊。
发表于 2003-10-19 18:47:42 | 显示全部楼层
也许是那人习惯那样写吧吧~,
>a.txt<b.txt cat ==cat b.txt>a.txt
发表于 2003-10-19 19:23:52 | 显示全部楼层
奇怪的、没用的用法,呵呵:
UUOC [from the comp.unix.shell group on Usenet] stands for `Useless Use of cat'; the reference is to the Unix command cat(1), not the feline animal. As received wisdom on comp.unix.shell observes, "The purpose of cat is to concatenate (or `catenate') files. If it's only one file, concatenating it with nothing at all is a waste of time, and costs you a process." Nevertheless one sees people doing

     cat file | some_command and its args ...

instead of the equivalent and cheaper

     <file some_command and its args ...

or (equivalently and more classically)

     some_command and its args ... <file

see http://en.wikipedia.org/wiki/Cat_(Unix)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表