From 574f64b84e4aedfcacaf9a636100235cfce91f1c Mon Sep 17 00:00:00 2001 From: Eric Nielsen Date: Wed, 26 May 2021 12:59:50 -0500 Subject: [PATCH] Also don't match the root directory (#216) besides the `$HOME` directory. A `z /` call will cd to the root directory anyway, because of how the code handles completion: # if we hit enter on a completion just go there case "$last" in # completions will always start with / /*) [ -z "$list" -a -d "$last" ] && builtin cd "$last" && return;; esac --- z.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/z.sh b/z.sh index b0e4aef..c47b5d8 100644 --- a/z.sh +++ b/z.sh @@ -56,8 +56,8 @@ _z() { if [ "$1" = "--add" ]; then shift - # $HOME isn't worth matching - [ "$*" = "$HOME" ] && return + # $HOME and / aren't worth matching + [ "$*" = "$HOME" -o "$*" = '/' ] && return # don't track excluded directory trees local exclude