Skip to content

Instantly share code, notes, and snippets.

@un4ckn0wl3z
Created August 2, 2025 08:31
Show Gist options
  • Save un4ckn0wl3z/3ed28acac88faaab928be665e5564384 to your computer and use it in GitHub Desktop.
Save un4ckn0wl3z/3ed28acac88faaab928be665e5564384 to your computer and use it in GitHub Desktop.
#!/bin/bash
while true; do
./YOUR_PROGRAM
EXIT_CODE=$?
if [ $EXIT_CODE -eq 0 ]; then
echo "Exited successfully, not restarting."
break
else
echo "Exited with error code $EXIT_CODE, restarting..."
sleep 1 # Optional delay before retry
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment