I am making a script that needs to loop over a list of files named like file1, file2, file3, all named the same with the suffix number increasing according to users input.
So I made thia script, but when I input number 3, she loops only over file1 and it stops. Why?
How do I make it loop over n files according to users input?
This is my script:
#!/bin/bash
echo "Base name of machines to bring down:"
read vm
echo "Number of machines:"
read num
COUNTER=0
while [ $COUNTER -lt $num ]; do
num=$[$COUNTER+1]
VBoxManage controlvm $vm$num poweroff
let COUNTER=COUNTER+1
done
num=$[$COUNTER+1]num=$[$COUNTER+1]read -p "Number of machines:" num?