小编LSp*_*ice的帖子

壳吃`?`字符

这是一个如此简单的问题,我确定有人问过它,但我找不到。我的外壳,我没有故意设置这样做,似乎吃任何涉及问号的词:

$ bash --version
GNU bash, version 4.3.42(1)-release (x86_64-apple-darwin13.4.0)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ echo a ? = =?
a =

$ not-a-command? echo a
a

$ (?) echo a
a
Run Code Online (Sandbox Code Playgroud)

如果它很重要,请注意任何包含问号的单词似乎完全无声地消失了 - 在某种程度上,她的 shell 甚至从未注意到调用以未指定有效可执行文件的单词开头 - 即使问号是不是一开始。

shell bash special-characters quoting

1
推荐指数
1
解决办法
1432
查看次数

标签 统计

bash ×1

quoting ×1

shell ×1

special-characters ×1