Dear Unix Gurus,
I have a list of files that I want to loop over....for example:
Code:
sl40_z11.70.txt
sl41_z11.40.txt
sl42_z11.10.txt
sl43_z10.80.txt
using the script
Code:
#!/bin/sh
#
echo -n "....enter first Z-coordinate position....."; read zpos
q="scale=3; $zpos"
p=0.3
#
loopNumber=$[($lastslice - $firstslice)+1]
echo "loopNumber is $loopNumber"
echo firstslice no. is $firstslice
for ((i=$firstslice; i<=$loopNumber; i++)); do
n=$[i]
for ((k=0; k<=$loopNumber; k++)); do
r=$[k] ; f=$r*$p ; zposition=$q-$f
echo "sl$[n]_z$[zposition].txt"
done
done
where
firstslice is 40 and
lastslice is 43 and
0.3 is the difference in z-cordinate btw the files.
My problem is that the script works fine with the exception that bash doesn't recognize $zposition. It apparently can't handle iteration with floating numbers? Can someone help?
Cheers