Pat*_*ryk 11 bash zsh glob expansion adb
我zsh在尝试使用logcat时遇到了以下错误.
即,输入时:
adb logcat *:D
Run Code Online (Sandbox Code Playgroud)
我在zsh中收到以下错误
zsh: no matches found: *:D
Run Code Online (Sandbox Code Playgroud)
我不得不逃避*:
adb logcat \*:D
Run Code Online (Sandbox Code Playgroud)
使用bash时,我没有收到以下错误.
为什么会这样?
Kev*_*vin 10
zsh如果你使用没有匹配的glob,默认情况下会警告你.另一方面,Bash将未展开的glob传递给app,如果您不确定哪些匹配(或者如果您犯了错误),则这是一个潜在的问题.您可以告诉zsh像bash一样传递未评估的参数setopt nonomatch:
NOMATCH (+3) <C> <Z>
If a pattern for filename generation has no matches, print an
error, instead of leaving it unchanged in the argument list.
This also applies to file expansion of an initial `~' or `='.
Run Code Online (Sandbox Code Playgroud)
或者删除参数,而不是setopt NULL_GLOB:
NULL_GLOB (-G)
If a pattern for filename generation has no matches, delete the
pattern from the argument list instead of reporting an error.
Overrides NOMATCH.
Run Code Online (Sandbox Code Playgroud)
Bash实际上有相同的选项(setopt nullglob),并可以模拟zshsetopt failglob
| 归档时间: |
|
| 查看次数: |
2335 次 |
| 最近记录: |