zsh:未知文件属性

zsh: unknown file attribute

我的 .zshrc 中有以下函数,理论上,它允许我在不需要引号的情况下编写提交消息。

cm(){
    git commit -m "$@"
}

当我 运行 它 (cm foo bar) 时,我得到以下错误:

zsh: unknown file attribute

$@ 在 zsh 中的意思和在 bash 中的意思一样吗?

根据 this 文章,*@ 都包含一个位置参数数组。

The parameters *, @ and argv are arrays containing all the positional parameters; thus $argv[n], etc., is equivalent to simply $n.

还有...

A subscript of the form [*] or [@] evaluates to all elements of an array; there is no difference between the two except when they appear within double quotes. "$foo[*]" evaluates to "$foo[1] $foo[2] ...", whereas "$foo[@]" evaluates to "$foo[1]" "$foo[2]" ....