3 ms·
Not mind-blowing but I use it all the time to loop a task a certain number of times. I always forget the bash command for loops so I just wrote a simple command
by pech0rin 4y ago
Not mind-blowing but I use it all the time to loop a task a certain number of times. I always forget the bash command for loops so I just wrote a simple command where I can run `loop 10 ./this-other thing and stuff` to loop ten times.
loop() {
NUM=$1
shift
for i in {1..$NUM}; do
"$@"
done
}
- Beltalowda 4y agozsh has "repeat" for that, and with "setopt short_repeat" (added in the last release) you can do: repeat 10; mycmd