符合POSIX标准的shell中的数组
发布时间:2020-12-16 01:21:46 所属栏目:安全 来源:网络整理
导读:根据 this reference sheet on hyperpolyglot.org,可以使用以下语法来设置数组. i=(1 2 3) 但我得到一个错误,破折号是Ubuntu上/ bin / sh的默认值,应该符合POSIX标准. # Trying the syntax with dash in my terminal dash -i$i=(1 2 3)dash: 1: Syntax error
根据
this reference sheet on hyperpolyglot.org,可以使用以下语法来设置数组.
i=(1 2 3) 但我得到一个错误,破折号是Ubuntu上/ bin / sh的默认值,应该符合POSIX标准. # Trying the syntax with dash in my terminal > dash -i $i=(1 2 3) dash: 1: Syntax error: "(" unexpected $exit # Working fine with bash > bash -i $i=(1 2 3) $echo ${i[@]} 1 2 3 $exit 参考表是误导性的还是错误的?
Posix不指定数组,因此如果限制为Posix shell功能,则不能使用数组.
我担心你的引用是错误的.可悲的是,并非您在互联网上找到的所有内容都是正确的. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |