bash - pointer in shell script? -
i trying print filename contains decimal point numbers...
l2.3stop.txt
i have variables defined :
z1=2.3 z2=3.4 z3=7.8 z4=8.9
and on
in loop runs 1 5
inside loop if
temp=`echo z$i`
and print file name using
echo l${temp}stop.txt
it prints
lz1stop.txt lz2stop.txt
etc..
how can print desired filename....
i tried using
echo l$((z$i))stop.txt
but works when z1, z2, z3 etc integers , not floating numbers....
i hope helps:
z1=2.3 z2=3.4 z3=7.8 z4=8.9 in {1..4};do echo l$(eval "echo \$z"$i)stop.txt done
or should work too:
for in {1..4};do echo l$(echo $(echo "\$z$i"))stop.txt done
outputs:
l2.3stop.txt l3.4stop.txt l7.8stop.txt l8.9stop.txt
Comments
Post a Comment