summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-03-23 08:04:10 +0200
committerLars Wirzenius <liw@liw.fi>2021-03-23 08:04:10 +0200
commit4b05862b26330e28f0f2354c57fa5feeb0ee22e2 (patch)
treee9577a29a2a277efe58d26af746ce67c367a03ed
parent247d61da1baa2b2d1bbbc5eafa2b47a2e261d589 (diff)
downloadextrautils-main.tar.gz
feat: add new script, "repeat"HEADmain
-rw-r--r--Makefile1
-rwxr-xr-xrepeat12
2 files changed, 13 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index be4b342..313eea9 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ scripts = \
prettyml \
prettyson \
print-argv \
+ repeat \
ssl-cert-gen \
totp
diff --git a/repeat b/repeat
new file mode 100755
index 0000000..afe3b92
--- /dev/null
+++ b/repeat
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+set -eu -o pipefail
+
+n="$1"
+shift
+
+i=0
+while [ "$i" -lt "$n" ] && "$@"
+do
+ i=$(( "$i" + 1 ))
+done