管道和输出(>)重定向操作符之间有什么区别?我在哪里可以用呢?
例如:
我通常只在grep上使用管道
find . | grep abc对于输入输出重定向,我遇到的唯一用途是用不同的输入输出测试程序。
例如:
abc.exe < in.txt > out.txt为什么我不能做这样的事:
xyz.exe | out.txt发布于 2013-07-17 09:01:48
管道(|)用于将小型(但重点突出的)程序串在一起,以执行复杂的任务。这是UNIX的核心理念。
例如:
$ ps -ef | fgrep http
$ sort myfile | uniq重定向(>或2>)只用于将标准输出(stdout)或标准错误(stderr)重定向到文件。
例如:
$ sort myfile | uniq > newfile
$ find / -name andy\* 2>/dev/nullhttps://stackoverflow.com/questions/17695259
复制相似问题