I have a script.sh
#!/bin/bash
for i in {1..$1}
do
echo $i
done
someone could explain me why if I try ./script.sh 10 my output is {1..10}? expected 1 2 ... 10
I have a script.sh
#!/bin/bash
for i in {1..$1}
do
echo $i
done
someone could explain me why if I try ./script.sh 10 my output is {1..10}? expected 1 2 ... 10
You're echoing the parameter that you're passing in instead of printing out the loop iteration. Try:
echo $i