From d96f3c99ec34e73e48ffef5fdb8d3dc071d134e2 Mon Sep 17 00:00:00 2001 From: rupa Date: Thu, 14 Apr 2011 08:28:08 -0400 Subject: [PATCH] bail out if we're another user but our env is still from olduser - prevent clobbering our db file --- z.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/z.sh b/z.sh index ce50d50..75eaaf9 100755 --- a/z.sh +++ b/z.sh @@ -24,6 +24,9 @@ z() { local datafile="$HOME/.z" + # bail out if we don't own ~/.z (we're another user but our ENV is still set) + [ "$(ls -l "$datafile" | cut -d' ' -f 3)" = "$USER" ] || return + # add entries if [ "$1" = "--add" ]; then shift