summaryrefslogtreecommitdiff
path: root/repeat
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 /repeat
parent247d61da1baa2b2d1bbbc5eafa2b47a2e261d589 (diff)
downloadextrautils-4b05862b26330e28f0f2354c57fa5feeb0ee22e2.tar.gz
feat: add new script, "repeat"
Diffstat (limited to 'repeat')
-rwxr-xr-xrepeat12
1 files changed, 12 insertions, 0 deletions
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