Skip to content

Instantly share code, notes, and snippets.

@leite08
Created March 23, 2023 21:25
Show Gist options
  • Save leite08/923557b6535ebb20dca6ca5baf41fc4f to your computer and use it in GitHub Desktop.
Save leite08/923557b6535ebb20dca6ca5baf41fc4f to your computer and use it in GitHub Desktop.
Shell script to run a command until it fails
#!/bin/bash
count=0
while "$@"; do (( count++ )); done && echo "It failed on the $count iteration"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment