Skip to content

Commit

Permalink
Add loop counting
Browse files Browse the repository at this point in the history
  • Loading branch information
anttiharju committed Jan 3, 2025
1 parent 679a362 commit 4748294
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/untilfail
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@
# UNTILFAIL:
# Run command in loop until it fails

count=0
# call commands in "" if you want to use &&
while sh -c "$@"; do :; done
while sh -c "$@"; do
count=$((count + 1))
done
echo "Succeeded $count times before failing"

0 comments on commit 4748294

Please sign in to comment.