2021年1月6日 星期三

Linux shell script 2>&1 ??? (轉貼)

 當我初次接觸shell script時,看別人寫的script或者範例時, 2>&1這類型的符號真困擾我.

找到了一篇文章,和各位分享 原文 http://bowen.blog.51cto.com/136148/94406

0 代表鍵盤輸入
1 代表螢幕輸出
2 代表錯誤輸出

Ref:

$ cat nop.txt > output.txt
cat: nop.txt: No such file or directory

Even if we redirect the stdout to a file, we still see the error output in the screen, because we are redirecting just the standard output, not the standard error.

沒有留言:

張貼留言