You are not logged in.
As 'm fairly new to scripting in linux there are still many things I don't know about the regular syntax. So I've made a script where in a variable $nb I retain the number of lines from the result of a series of commands. I have to use a variable as the number of lines from the output is not the same all the time.
To finish my script I need to use a for loop something like this
for i in {1..$nb}
do
echo "bla bla bla $i"
done
the thing is if $nb, for example, has the value 29 it outputs
bla bla bla {1..29}
without doing any loop.
So how can I use a variable, to define the edge of an interval in a for statement ?
Last edited by I'mGeorge (2011-06-18 16:19:16)
I've first installed Arch in March
Offline
Piece of my code:
range=$( seq $1 $(($1+$2-1)) );
for y in $range;
Offline
thanks karol it works like a charm using
range=$(seq 1 $nb)
I've first installed Arch in March
Offline
Your original code does work in zsh, just not in bash.
Offline
Offline