shell中返回一个数组

#!/bin/sh

get_array()
{
a=123
b="123"
c="abc"
echo "$a \"$b\" $c"
}
echo \(`get_array`\)

eval " tt=$(echo \( $(get_array) \) ) "

echo "----XXX ${tt[0]}"
echo "----XXX ${tt[1]}"
echo "----XXX ${tt[2]}"
echo "----XXX ${tt[3]}"
echo "----XXX ${tt[4]}"
echo "----XXX ${tt[5]}"

文章标题:shell中返回一个数组
URL标题:http://csdahua.cn/article/ghhpgi.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流