If your range has a variable, use seq
, like this:
count=10
for i in $(seq $count); do
command
done
Simply:
for run in {1..10}; do
command
done
Or as a one-liner, for those that want to copy and paste easily:
for run in {1..10}; do command; done
More Related Contents:
- How can I escape white space in a bash loop list?
- Emulating a do-while loop in Bash
- How do you run a command eg chmod, for each line of a file?
- Looping through alphabets in Bash
- How to loop through dates using Bash?
- Looping through all files in a directory [duplicate]
- Bash scripting, multiple conditions in while loop
- Syntax for a single-line while loop in Bash
- How to iterate over list which contains whitespaces in bash
- Retry a Bash command with timeout
- Reading lines in a file and avoiding lines with # with Bash
- Make Bash handle variables like Batch
- Some troubles with using sed and awk [closed]
- Why would a correct shell script give a wrapped/truncated/corrupted error message? [duplicate]
- Add a new element to an array without specifying the index in Bash
- Lookup shell variables by name, indirectly [duplicate]
- How do I use su to execute the rest of the bash script as that user?
- How to iterate over associative arrays in Bash
- How to process each output line in a loop?
- bash: force exec’d process to have unbuffered stdout
- How to include an ‘&’ character in a bash curl statement
- How do I echo stars (*) when reading password with `read`?
- Reading key/value parameters from a file into a shell script
- Bash: Copy named files recursively, preserving folder structure
- Using dot or “source” while calling another script – what is the difference?
- osascript using bash variable with a space
- How to use > in an xargs command?
- How execute bash script line by line?
- How to update one file in a zip archive
- What is the proper way to test a Bash function’s return value?