网站建设资讯

NEWS

网站建设资讯

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://cdweb.net/article/ghhpgi.html