Created
April 13, 2022 12:57
-
-
Save Cayan/a5f995ea23139eb9a51354ddea79ad69 to your computer and use it in GitHub Desktop.
Executes a program multiple times and reports on exit codes
This file contains 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 | |
TOTAL=100 | |
printf "Starting the script\n" | |
for i in `seq 1 $TOTAL`; do | |
trap 'printf "\nExited!"; break;' SIGINT SIGTERM | |
printf '\r%i / %i' $i $TOTAL | |
$@ >> debugger.log 2>&1 | |
array+=($?) | |
done | |
result=() | |
for d in ${array[@]} ; do | |
((result[$d]++)) | |
done | |
printf "\n\nResults\n" | |
for x in "${!result[@]}"; do printf "Status code %s reported %s times\n" "$x" "${result[$x]}" ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment