Skip to content

Instantly share code, notes, and snippets.

@evilchili
Created December 9, 2014 15:28
Show Gist options
  • Save evilchili/03d22fcb1a26891135d4 to your computer and use it in GitHub Desktop.
Save evilchili/03d22fcb1a26891135d4 to your computer and use it in GitHub Desktop.
execute a command n times and report the percentage of success
#!/bin/bash
ITER=10
SCALE=3
CMD=$*
bc <<< "scale=$SCALE; $(for i in `seq 1 $ITER`; do $CMD &>/dev/null && echo $?; sleep 1; done | wc -l)/$ITER * 100"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment