summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-11-08 07:22:40 -0300
committerEuAndreh <eu@euandre.org>2024-11-08 07:22:43 -0300
commit85c16629dc812b84bed9eb09673b9f97921eee8e (patch)
treecef8532fd25c6631addfc3198d96198b2b8cd846 /src
parentAdd AWK version of uri(1) Perl utility (diff)
downloadeut-85c16629dc812b84bed9eb09673b9f97921eee8e.tar.gz
eut-85c16629dc812b84bed9eb09673b9f97921eee8e.tar.xz
src/untill: Add -q option, remove -h
Diffstat (limited to 'src')
-rwxr-xr-xsrc/untill12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/untill b/src/untill
index 34532de..7a4c1a9 100755
--- a/src/untill
+++ b/src/untill
@@ -4,13 +4,14 @@ set -eu
usage() {
cat <<-'EOF'
Usage:
- until [-m MAX] [-n SECONDS] COMMAND...
+ until [-m MAX] [-n SECONDS] [-q] COMMAND...
EOF
}
_SECONDS=5
-while getopts 'm:n:h' flag; do
+QUIET=false
+while getopts 'm:n:q' flag; do
case "$flag" in
(m)
MAX="$OPTARG"
@@ -18,6 +19,9 @@ while getopts 'm:n:h' flag; do
(n)
_SECONDS="$OPTARG"
;;
+ (q)
+ QUIET=true
+ ;;
(*)
usage >&2
exit 2
@@ -29,7 +33,9 @@ shift $((OPTIND - 1))
ATTEMPT=1
while true; do
- printf 'Attempt %s.\n' "$ATTEMPT" >&2
+ if [ "$QUIET" = false ]; then
+ printf 'Attempt %s.\n' "$ATTEMPT" >&2
+ fi
ATTEMPT=$((ATTEMPT + 1))
if "$@"; then
break