File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket.
1010
1111For a steady stream of TILs, [ sign up for my newsletter] ( https://crafty-builder-6996.ck.page/e169c61186 ) .
1212
13- _ 1297 TILs and counting..._
13+ _ 1298 TILs and counting..._
1414
1515---
1616
@@ -1293,6 +1293,7 @@ _1297 TILs and counting..._
12931293- [ Provide A Fallback Value For Unset Parameter] ( unix/provide-a-fallback-value-for-unset-parameter.md )
12941294- [ Remove A Directory Called ` -p ` ] ( unix/remove-a-directory-called-dash-p.md )
12951295- [ Repeat Yourself] ( unix/repeat-yourself.md )
1296+ - [ Run A Command Repeatedly Several Times] ( unix/run-a-command-repeatedly-several-times.md )
12961297- [ Safely Edit The Sudoers File With Vim] ( unix/safely-edit-the-sudoers-file-with-vim.md )
12971298- [ Saying Yes] ( unix/saying-yes.md )
12981299- [ Search Files Specific To A Language] ( unix/search-files-specific-to-a-language.md )
Original file line number Diff line number Diff line change 1+ # Run A Command Repeatedly Several Times
2+
3+ From the terminal in a Bash or Zsh shell session, I can loop on a command to
4+ have it run a specific number of times.
5+
6+ If I want to run a test command (e.g. ` bin/test some_file.spec:123 ` ) 12 times
7+ in a row, I could use a for loop like so:
8+
9+ ``` bash
10+ for i in {1..12}; do bin/test some_file.spec:123; done
11+ ```
12+
13+ And the shell will run the command one time after another until it has been run
14+ 12 times. That range ` {1..12} ` can be adjusted to whatever I want. For
15+ instance, to have it loop 3 times, I'd make it into ` {1..3} ` .
16+
17+ [ source] ( https://serverfault.com/questions/273238/how-to-run-a-command-multiple-times-using-bash-shell )
You can’t perform that action at this time.
0 commit comments