bleakwind 发表于 2015-12-03 10:52

shell关于重定向标准错误输出的问题.

rm /path/to/myfile 2>&1

这样为何把2也识别为要删除的文件了?
当前目录下会建立文件1内容为:
rm: /path/to/myfile: No such file or directory
rm: 2: No such file or directory

lsstarboy 发表于 2015-12-03 11:19

shell不一样,默认是csh,你可以改为sh再试

bleakwind 发表于 2015-12-15 04:36

页头加的是/bin/sh

lsstarboy 发表于 2015-12-15 10:06

sh测试了没问题
页: [1]
查看完整版本: shell关于重定向标准错误输出的问题.