This question already has an answer here:
i try to code a script. it ask me how many "anything" you want? and i answered with a number like 10
#!/bin/bash
echo -n "Please enter some input: "
read input
now I like perform a command 10 times include numbers from 001 to 010 for example i get the right numbers with:
seq -f "%03g" 1 $input
but how can I execute now commands using this number like:
command anyname-001 -some -parameter
command anyname-002 -some -parameter
command anyname-003 -some -parameter
....
thanx for help
With GNU bash:
If everything looks okay, remove
echo
.Just use a for loop over the range. That should do the trick.
One line (well, formally two):
Call the script as: