index : devtools32 | |
Archlinux32 fork of devtools | gitolite user |
summaryrefslogtreecommitdiff |
author | Luke Shumaker <lukeshu@parabola.nu> | 2013-05-27 00:40:54 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2017-04-05 14:09:14 -0400 |
commit | 55d5e061cb3d955faaf6ed291eb7294b84706a83 (patch) | |
tree | c1fb11fba15acfc9f0344c900b3ca26965b86b36 /lib/common.sh | |
parent | 3183ea07b02bb4e16db0a4eeb160e818b37926af (diff) |
-rw-r--r-- | lib/common.sh | 7 |
diff --git a/lib/common.sh b/lib/common.sh index 19aa7de..4536668 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -1,4 +1,5 @@ #!/hint/bash +# This may be included with or without `set -euE` # License: Unspecified @@ -8,7 +9,7 @@ export LANG=C shopt -s extglob # check if messages are to be printed using color -unset ALL_OFF BOLD BLUE GREEN RED YELLOW +declare ALL_OFF='' BOLD='' BLUE='' GREEN='' RED='' YELLOW='' if [[ -t 2 ]]; then # prefer terminal safe colored and bold text when tput is supported if tput setaf 0 &>/dev/null; then @@ -65,14 +66,14 @@ stat_done() { _setup_workdir=false setup_workdir() { - [[ -z $WORKDIR ]] && WORKDIR=$(mktemp -d --tmpdir "${0##*/}.XXXXXXXXXX") + [[ -z ${WORKDIR:-} ]] && WORKDIR=$(mktemp -d --tmpdir "${0##*/}.XXXXXXXXXX") _setup_workdir=true trap 'trap_abort' INT QUIT TERM HUP trap 'trap_exit' EXIT } cleanup() { - if [[ -n $WORKDIR ]] && $_setup_workdir; then + if [[ -n ${WORKDIR:-} ]] && $_setup_workdir; then rm -rf "$WORKDIR" fi exit ${1:-0} |