From ca5661cb39c8a32b06cd716376c1623a7b753960 Mon Sep 17 00:00:00 2001 From: rupa Date: Fri, 22 Feb 2013 15:20:08 -0500 Subject: [PATCH] Add warning message if z.sh is executed instead of sourced. Closes #74 --- z.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/z.sh b/z.sh index 4bad37a..1aebd2a 100755 --- a/z.sh +++ b/z.sh @@ -21,6 +21,11 @@ # * z -t foo # cd to most recently accessed dir matching foo # * z -l foo # list all dirs matching foo (by frecency) +case $- in + *i*) ;; + *) echo 'ERROR: z.sh is meant to be sourced, not directly executed.' +esac + _z() { local datafile="${_Z_DATA:-$HOME/.z}"