根据
this reference sheet on hyperpolyglot.org,可以使用以下语法来设置数组.
原文链接:https://www.f2er.com/bash/384457.htmli=(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