【发布时间】:2015-07-29 07:57:58
【问题描述】:
使用从源代码编译的破折号二进制文件(版本 0.5.8,可在 http://gondor.apana.org.au/~herbert/dash/files/dash-0.5.8.tar.gz 获得),执行
dash -c ':'
失败
dash: 1: :: Permission denied
这意味着诸如
之类的构造case foo in
*bar*) :
do_stuff ;;
*) :
;;
esac
失败,这会破坏很多脚本。为什么用ubuntu分发的dash二进制没有这个问题?
【问题讨论】:
-
CNR。运行我自己的构建,同一个命令没有失败。
-
$ ~/local/opt/dash-0.5.8/bin/dash -c ': && echo "null command exited successfully"';仅输出:null command exited successfully -
我很好奇,顺便说一句——你是否从
true得到同样的失败?如果您阅读源代码,true和:的实现方式相同。 -
嗯,真正的作品,:没有。
-
您在哪个操作系统上试用过?刚刚测试了 true 和 : 对我来说在 OS X 上工作,但是 : 在 ubuntu 14.04 上从源代码编译时不起作用。
标签: shell ubuntu posix dash-shell