diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-02-13 23:34:27 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-02-13 23:34:27 +1300 |
commit | 196a9c47f77b8bfd8b3376449d66b0be06da6d49 (patch) | |
tree | 772862a7e8cf704618ad6447d9643e159dbdf868 /bin/try | |
parent | Fix var declaration (diff) | |
download | dotfiles-196a9c47f77b8bfd8b3376449d66b0be06da6d49.tar.gz dotfiles-196a9c47f77b8bfd8b3376449d66b0be06da6d49.zip |
A few more comments
Diffstat (limited to 'bin/try')
-rwxr-xr-x | bin/try | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -89,12 +89,20 @@ trap cleanup EXIT # if we succeed on any of them declare -i ret for (( atti = 1 ; atti <= attc ; atti++ )) ; do + + # If verbose, print the number of this attempt ((verbose)) && printf '%s: Attempt %u/%u to run `%s` ...\n' \ "$self" "$atti" "$attc" "${cmd[*]}" + + # Try running the command. If it succeeds, report failure if verbose, and + # exit 0. if "${cmd[@]}" 2>>"$errbuf" ; then ((verbose)) && printf '%s: Success!\n' \ "$self" exit 0 + + # If it fails, keep the exit value, report failure, and wait until the next + # attempt. else ret=$? ((verbose)) && printf '%s: Failure!\n' \ |