【发布时间】:2021-11-09 22:17:50
【问题描述】:
我正在玩 i/o shell 重定向。我尝试过的命令(在 bash 中):
ls -al *.xyz 2>&1 1> files.lst
和
ls -al *.xyz 1> files.lst 2>&1
当前文件夹中没有任何*.xyz 文件。
这些命令给了我不同的结果。第一个命令在屏幕上显示错误消息ls: *.xyz: No such file or directory。但是第二个将此错误消息打印到文件中。为什么第一个命令无法将 err 输出写入文件?
【问题讨论】:
标签: bash shell stdout stderr io-redirection