#!/bin/sh
var=","
gn=8
#init
tn=`expr 10 + $gn`
for k in $(seq 10 $tn);do
var=$var$k','
eval "gvar$k"="m$k"
done
#change it
var=${var/14/00}
#get it
for k in $(seq 0 $gn);do
case ${var:`expr 3 \* $k`:4} in
',00,')
echo "ok $gn "
break
;;
*)
echo ${var:`expr 3 \* $k`:4}
;;
esac
done
lst="gvar"`expr 10 + $k`
echo "last $k $lst"
var1=`eval echo '$'$lst`
echo $var1
echo ${var1:0:1}
echo ${var1/2/0}