Skip to content

Instantly share code, notes, and snippets.

@luizbills
Last active February 23, 2025 14:34
Show Gist options
  • Save luizbills/d3da523b27cbe681f7de4503f3daa031 to your computer and use it in GitHub Desktop.
Save luizbills/d3da523b27cbe681f7de4503f3daa031 to your computer and use it in GitHub Desktop.
Bash script to run a command N times
#!/usr/bin/env bash
for (( i = 0; i < $1; i++ )); do
eval "${@:2}"
done

runn

Run a command N times

Usage

$ # usage: runn <times> <command>
$ runn 3 echo "hello"
hello
hello
hello
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment