I'm trying to produce a rather simple bash script with a single for
loop whose range should be passed when calling it.
This is what I have:
#!/bin/bash
for i in {$1..$2}
do
file=file_$i.txt
echo $file
done
which I call using: ./my_script.sh 01 06
.
The output I'm after is:
file_01.txt
file_02.txt
file_03.txt
file_04.txt
file_05.txt
file_06.txt
(notice that there's a leading 0
, this is important) but what I get with the above script is:
file_{01..20}.txt
What am I doing wrong?