为什么看似zsh
明白要做什么some_variable=1 command
,却又不明白some-variable=1 command
?例如:$ fs_screen=1 mpv --fs-screen=${fs_screen} someFile.mp4
工作正常,但$ fs-screen=1 mpv --fs-screen=${fs-screen} someFile.mp4
结果是zsh: command not found: fs-screen=1
我深入研究了 zsh 文档,发现了我认为的问题所在。摘自https://zsh.sourceforge.io/Doc/Release/Shell-Grammar.html#Precommand-Modifiers:
A simple command may be preceded by a precommand modifier, which will alter how the command is interpreted. These modifiers are shell builtin commands with the exception of nocorrect which is a reserved word.
-
The command is executed with a ‘-’ prepended to its argv[0] string.
但是,我在任何地方都找不到有关此内容的更多信息。它的目的是什么,是否可以禁用它,以便我可以使用some-variable
而不是some_variable
?