diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-31 14:19:57 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-12-31 14:29:17 +1300 |
commit | 0c84989ca0b97ca1d075e7a304a407553e34381d (patch) | |
tree | 2188a585aef6ed345b1c575da6f63445baabf522 /bin/gms.sh | |
parent | Add clarifying comment (diff) | |
download | dotfiles-0c84989ca0b97ca1d075e7a304a407553e34381d.tar.gz dotfiles-0c84989ca0b97ca1d075e7a304a407553e34381d.zip |
Clarify control flow in shell scripts
Diffstat (limited to 'bin/gms.sh')
-rw-r--r-- | bin/gms.sh | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -3,7 +3,9 @@ # Trap to remove whatever's set in lockdir if we're killed lockdir= cleanup() { - [ -n "$lockdir" ] && rm -fr -- "$lockdir" + if [ -n "$lockdir" ] ; then + rm -fr -- "$lockdir" + fi if [ "$1" != EXIT ] ; then trap - "$1" kill "-$1" "$$" @@ -23,7 +25,8 @@ for rcfile in "${GETMAIL:-"$HOME"/.getmail}"/getmailrc.* ; do ( lockdir=${TMPDIR:-/tmp}/getmail.$uid.${rcfile##*/}.lock mkdir -m 0700 -- "$lockdir" 2>/dev/null || exit try -n 3 -s 15 getmail --rcfile "$rcfile" "$@" - rm -fr -- "$lockdir" && lockdir= + rm -fr -- "$lockdir" + lockdir= ) & done # Wait for all of the enqueued tasks to finish |