rupa / z

z - jump around
Do What The F*ck You Want To Public License
16.17k stars 1.16k forks source link

PR #293 breaks `z` completely when `$_Z_EXCLUDE_DIRS` is empty #301

Closed queensferryme closed 3 years ago

queensferryme commented 3 years ago

Related: #293

When $_Z_EXCLUDE_DIRS is empty,

case "$*" in "$exclude"*) return;; esac

becomes

case "$*" in *) return;; esac

This means that all directories will be excluded!

For demonstration, I add this line to z.sh:

diff --git a/z.sh b/z.sh
index c47b5d8..b707689 100644
--- a/z.sh
+++ b/z.sh
@@ -64,6 +64,7 @@ _z() {
         for exclude in "${_Z_EXCLUDE_DIRS[@]}"; do
             case "$*" in "$exclude"*) return;; esac
         done
+        echo 'continue'

         # maintain the data file
         local tempfile="$datafile.$RANDOM"

图片