How Do I Run the Same Command Multiple Times in Linux?
Contents How Do I Run a Command Multiple Times in Linux Terminal? How to Run a Command Multiple Times in Bash Wrap Your Statement for I in {1. .N}; Do...
Contents
How do I run a command multiple times in Linux terminal?
How To Run a Command Multiple Times in Bash
- Wrap your statement for i in {1..n}; do someCommand; done , where n is a positive number and someCommand is any command.
- To access the variable (I use i but you can name it differently), you need to wrap it like this: ${i} .
- Execute the statement by pressing the Enter key.
Must Read
How do you repeat a command in Linux?
How to Run or Repeat a Linux Command Every X Seconds Forever
- Use watch Command. Watch is a Linux command that allows you to execute a command or program periodically and also shows you output on the screen. …
- Use sleep Command. Sleep is often used to debug shell scripts, but it has many other useful purposes as well.