錯誤信息總是被打印到終端每當我得到的bash shell(例如窮人語法)錯誤
$ totem Desktop/songs/song1.mp3
** Message: Error: Resource not found.
gstfilesrc.c(1055): gst_file_src_start(): /GstPlayBin2:play/GstURIDecodeBin:uridecodebin0/GstFileSrc:source:
No such file "/home/me/Desktop/songs/song1.mp3"
那麼什麼是重定向標準錯誤,如果標準錯誤會直接默認打印到終端到stdout的目的是什麼?
$ command-name 2>&1
@ Didier Trosset。謝謝!那麼,爲什麼我要將stderr重定向到stdout呢? – user784637
@LedZeppelin:如果你希望輸出和錯誤都記錄在同一個文件中;)這不是我要做的事情,但情況可能要求它 – Sujoy
你不能將輸出和錯誤都重定向到同一個文件用'$ command1&> errorAndOutput'? – user784637