names=( Jennifer Tonya Anna Sadie ) for name in ${names[@]} do echo $name done
names=( Jennifer Tonya Anna Sadie ) for (( i = 0 ; i < ${#names[@]} ; i++ )) do echo ${names[$i]} done2. Variable substitution for shell script
$DEVICE0=eth0 $echo "Configure interface " ${!DEVICE${i}}
$n=1 $ eval echo \${$n}
$ n="date" $ echo $($n)Output :Wed May 21 20:39:00 EEST 2008
3. Increment i in the while loop
i=$(($i+1)) i=`expr i + $i`
沒有留言:
張貼留言