How do I iterate over a range of numbers in Bash when the range is given by a variable?
I know I can do this (called "sequence expression" in the Bash documentation):
for i in {1..5}; do echo $i; done
Which …
I need to write a script that starts my program with different arguments, but I'm new to Bash. I start my program with:
./MyProgram.exe Data/data1.txt [Logs/data1_Log.txt].
Here is the pseudocode for what I want …
I have a basic number for loop which increments the variable num by 1 over each iteration...
for (( num=1; num<=5; num++ ))
do
echo $num
done
Which outputs:
1
2
3
4
5
I'm trying to make it produce the output (add leading zero before $num):
01
02
03
04
05
…