Shell how to let a array as other shell args? -
i have 2 shell script a.sh,b.sh .
--------a.sh--------- array=(1.1 1.2 1.3) ./b.sh $array --------end a.sh--------- --------b.sh--------- packageversionarr=$1 in ${packageversionarr[@]}; echo $i done --------end b.sh--------- console print: 1.1
where 1.2 , 1.3?
$array
first element, need ${array[*]}
. see arrays in guide.
bash -x $ array=(1.1 1.2 1.3) + array=(1.1 1.2 1.3) $ ./b.sh $array + ./b.sh 1.1 ... $ ./b.sh ${array[*]} + ./b.sh 1.1 1.2 1.3 ...
Comments
Post a Comment