【发布时间】:2011-01-29 20:24:36
【问题描述】:
如果 glob 模式不匹配任何文件,bash 将只返回文字模式:
bash-4.1# echo nonexistent-file-*
nonexistent-file-*
bash-4.1#
您可以通过设置nullglob shell 选项来修改默认行为,因此如果没有匹配项,您将得到一个空字符串:
bash-4.1# shopt -s nullglob
bash-4.1# echo nonexistent-file-*
bash-4.1#
那么ash 中是否有等效选项?
bash-4.1# ash
~ # echo nonexistent-file-*
nonexistent-file-*
~ # shopt -s nullglob
ash: shopt: not found
~ #
【问题讨论】:
标签: bash shell scripting shopt