我正在阅读鱼壳的 git.fish 完成脚本(/usr/local/Cellar/fish/2.1.2/share/fish/completions),但在理解语法含义时遇到了一些问题。
在街区,
function __fish_git_needs_command
set cmd (commandline -opc)
if [ (count $cmd) -eq 1 -a $cmd[1] = 'git' ]
return 0
end
return 1
end
我知道cmd
设置为commandline -opc
. 但是在下一个语句中,(count $cmd) -eq 1 -a $cmd[1] = 'git'
是什么意思?-eq
-a
我是fish shell的新手,我试图通过为程序编写自己的完成脚本来理解语法。帮助将不胜感激。
谢谢你。