加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

zsh:未知文件属性

发布时间:2020-12-13 22:59:21 所属栏目:Linux 来源:网络整理
导读:我的.zshrc中有以下函数,理论上,它允许我编写提交消息而不需要引号. cm(){ git commit -m "$@"} 当我运行它(cm foo bar)时,我收到以下错误: zsh: unknown file attribute $@在zsh中是否与bash中的相同? 解决方法 根据 this文章,*和@都包含一个位置参数数组
我的.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]" ....

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读