From db8166fce8f862350d5818c3131bda7eb8524998 Mon Sep 17 00:00:00 2001 From: Andrew Tomaka Date: Sat, 12 Mar 2022 11:24:22 -0500 Subject: [PATCH] Run commands repeatedly --- zsh/.config/zsh/functions | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/zsh/.config/zsh/functions b/zsh/.config/zsh/functions index 7cd7a01..e612058 100644 --- a/zsh/.config/zsh/functions +++ b/zsh/.config/zsh/functions @@ -78,6 +78,18 @@ function password-generator { echo $password } +function run { + if [ $# -lt 2 ]; then + echo Usage: run NUMBER COMMAND + else + number=$1; shift + + for i in `seq $number`; do + eval "$@" + done + fi +} + function test-rails { if bundle exec rspec --help > /dev/null 2>&1; then if [ -d spec ]; then