Created
February 17, 2023 18:10
-
-
Save andrross/b945fef5170401f518a1c73129f6414c to your computer and use it in GitHub Desktop.
Bash script to repeat a command until a non-zero exit code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
i=1 | |
while [ true ] | |
do | |
"$@" | |
if [ "$?" = 0 ]; then | |
echo "SUCCESS ($i)" | |
else | |
echo "FAILURE ($i)" | |
break | |
fi | |
((i=i+1)) | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment