summaryrefslogtreecommitdiff
path: root/db-functions
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2014-01-08 21:04:43 -0500
committerLuke Shumaker <LukeShu@sbcglobal.net>2014-01-08 21:19:01 -0500
commitb6e8ebd66d22abf5439485985a7851e768c71e8a (patch)
treeeec7fafd8aa2285dd3b706bb1e433a0ed10c87e5 /db-functions
parent1d08899c3ac82047fe614a7694e5a7235f808cfd (diff)
Be very careful about using $0.
Diffstat (limited to 'db-functions')
-rw-r--r--db-functions14
1 files changed, 7 insertions, 7 deletions
diff --git a/db-functions b/db-functions
index 59e9c29..26b23e4 100644
--- a/db-functions
+++ b/db-functions
@@ -16,7 +16,7 @@ restore_umask () {
}
# set up general environment
-WORKDIR=$(mktemp -dt "$(basename $0).XXXXXXXXXX")
+WORKDIR=$(mktemp -dt "${0##*/}.XXXXXXXXXX")
LOCKS=()
# check if messages are to be printed using color
@@ -85,10 +85,10 @@ get_full_version() {
}
script_lock() {
- local LOCKDIR="$TMPDIR/.scriptlock.$(basename $0)"
+ local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}"
if ! mkdir "$LOCKDIR" >/dev/null 2>&1 ; then
local _owner="$(/usr/bin/stat -c %U $LOCKDIR)"
- error "Script $(basename $0) is already locked by $_owner."
+ error "Script ${0##*/} is already locked by $_owner."
exit 1
else
set_umask
@@ -97,9 +97,9 @@ script_lock() {
}
script_unlock() {
- local LOCKDIR="$TMPDIR/.scriptlock.$(basename $0)"
+ local LOCKDIR="$TMPDIR/.scriptlock.${0##*/}"
if [ ! -d "$LOCKDIR" ]; then
- warning "Script $(basename $0) was not locked!"
+ warning "Script ${0##*/} was not locked!"
restore_umask
return 1
else
@@ -123,8 +123,8 @@ cleanup() {
repo_unlock $repo $arch
fi
done
- if [ -d "$TMPDIR/.scriptlock.$(basename $0)" ]; then
- msg "Removing left over lock from $(basename $0)"
+ if [ -d "$TMPDIR/.scriptlock.${0##*/}" ]; then
+ msg "Removing left over lock from ${0##*/}"
script_unlock
fi
rm -rf "$WORKDIR"