Skip to content

Instantly share code, notes, and snippets.

@neocoder
Created January 30, 2018 08:20
Show Gist options
  • Save neocoder/3003df7ae9e8ae8f79d13b7ab72dc2b1 to your computer and use it in GitHub Desktop.
Save neocoder/3003df7ae9e8ae8f79d13b7ab72dc2b1 to your computer and use it in GitHub Desktop.
runs command until it finishes with error code
#!/usr/bin/env bash
counter=0
while [ $? -eq 0 ]; do
counter=$((counter+1))
clear
echo "Iteration: $counter";
$@
done
declare -r x="Crashed at ${counter} iteration"
echo $x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment