1
「1> & 2」在bash腳本中是什麼意思?「1>&2」在bash中的含義是什麼?
例如,bash腳本中的以下行是做什麼的?
echo "$1 is not a directory!" 1>&2
我使用的是mac os x。我的bash腳本是:
if [ ! -d $1 ]; then
echo "$1 is not a directory" 1>&2
exit 1
fi
「1> & 2」在bash腳本中是什麼意思?「1>&2」在bash中的含義是什麼?
例如,bash腳本中的以下行是做什麼的?
echo "$1 is not a directory!" 1>&2
我使用的是mac os x。我的bash腳本是:
if [ ! -d $1 ]; then
echo "$1 is not a directory" 1>&2
exit 1
fi
它將消息輸出到stderr。 「1> & 2」表示將stdout重定向到stderr。 http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html
「'1&2#將stdout重定向到stderr.」 - 來自[I/O重定向](http://www.tldp.org/LDP/abs/html/io-redirection.html) –
搜索對於'[bash]「1&2」'顯示799 Q/A。在發佈之前你有沒有打擾過?祝你好運。 – shellter
@shellter無需發表重複的評論說同樣的事情。 –