From 04995cbe1c4e7494b65a63f223e5e2ddfd789e33 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 10 May 2014 18:08:49 -0400 Subject: lib/common.sh: Use `[[ a -ef b ]]` instead of double calls to `readlink -f` --- lib/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/common.sh b/lib/common.sh index 455e841..7f83bdd 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -145,7 +145,7 @@ lock() { local mesg=("${@:3}") # Only reopen the FD if it wasn't handed to us - if [[ "$(readlink -f /dev/fd/$fd)" != "$(readlink -f "$file")" ]]; then + if ! [[ "/dev/fd/$fd" -ef "$file" ]]; then mkdir -p "${file%/*}" eval "exec $fd>"'"$file"' fi @@ -166,7 +166,7 @@ slock() { local mesg=("${@:3}") # Only reopen the FD if it wasn't handed to us - if [[ "$(readlink -f /dev/fd/$fd)" != "$(readlink -f "$file")" ]]; then + if ! [[ "/dev/fd/$fd" -ef "$file" ]]; then mkdir -p "${file%/*}" eval "exec $fd>"'"$file"' fi -- cgit v1.2.3