[arch-projects] [devtools] [PATCH 1/2] lib/common.sh: Use double brackets
Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- lib/common.sh | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/common.sh b/lib/common.sh index feb5080..e826e97 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -58,14 +58,14 @@ stat_done() { } setup_workdir() { - [ -z "$WORKDIR" ] && WORKDIR=$(mktemp -d /tmp/$(basename $0).XXXXXXXXXX) + [[ -z $WORKDIR ]] && WORKDIR=$(mktemp -d /tmp/$(basename $0).XXXXXXXXXX) } cleanup() { trap - EXIT INT QUIT TERM - [ -n "$WORKDIR" ] && rm -rf "$WORKDIR" - [ "$1" ] && exit $1 + [[ -n $WORKDIR ]] && rm -rf "$WORKDIR" + [[ $1 ]] && exit $1 } abort() { -- 1.7.7.2
* Honor TMPDIR variable (just like we did in commit a0c6bf45). * Quote path properly. * Avoid unnecessary use of basename(1). Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de> --- lib/common.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/common.sh b/lib/common.sh index e826e97..6bbf6de 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -58,7 +58,7 @@ stat_done() { } setup_workdir() { - [[ -z $WORKDIR ]] && WORKDIR=$(mktemp -d /tmp/$(basename $0).XXXXXXXXXX) + [[ -z $WORKDIR ]] && WORKDIR=$(mktemp -d --tmpdir "${0##*/}.XXXXXXXXXX") } cleanup() { -- 1.7.7.2
participants (1)
-
Lukas Fleischer