I am new to Unix programming and I am not able to figure out what is wrong with this code:
#!/bin/sh
i=1
max=10
for i in {1..$max}
do
echo $i;
done
If I try the above code as follows it works:
#!/bin/sh
i=1
max=10
for i in {1..10}
do
echo $i;
done
I have tried this:
#!/bin/sh
i=1
max=10
for i in {1..`echo $max`}
do
echo $i;
done
and
#!/bin/sh
i=1
max=10
for i in {1..`expr $max`}
do
echo $i;
done
and
#!/bin/sh
i=1
max=10
for i in {1..`echo $max | bc`}
do
echo $i;
done
But it is also not working.. Can anyone tell me how come it will work..?