#!/bin/bash
str=(
"zhangsan" "29"
"lisi" "30"
)
array=($str)
function test()
{
echo "param" $@
array=(`echo "$@"`)
for i in $array
do
echo $i
done
len=${#array[@]}
echo $len
for ((i=0;i<len/2;i++))
do
echo ${array[$i * 2]} "-- " ${array[$i * 2 + 1]}
done
}
test "${str[*]}"
网友评论