From e961f14f55205d42a58c33ee981f6003df6cca10 Mon Sep 17 00:00:00 2001 From: ianmacd <> Date: Sat, 5 Jan 2002 19:48:59 +0000 Subject: [PATCH] fixed _cd() so that if $CDPATH is set and no completions are returned relative to its paths, we still attempt directory completion relative to $PWD --- bash_completion | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bash_completion b/bash_completion index e36b7ffa..d0c24138 100644 --- a/bash_completion +++ b/bash_completion @@ -2,7 +2,7 @@ # # # @@ -1253,7 +1253,10 @@ _cd() fi # standard dir completion if parameter starts with /, ./ or ../ - [[ "$cur" == ?(.)?(.)/* ]] && COMPREPLY=( $( compgen -d $cur ) ) && return 0 + if [[ "$cur" == ?(.)?(.)/* ]]; then + COMPREPLY=( $( compgen -d $cur ) ) + return 0 + fi if [ -n "$CDPATH" ]; then # we have a CDPATH, so loop on its contents for i in ${CDPATH//:/ }; do @@ -1262,9 +1265,8 @@ _cd() # add subdirs to list of completions as necessary [ ${#dirs[@]} ] && COMPREPLY=( ${COMPREPLY[@]} ${dirs[@]#$i/}) done - else - COMPREPLY=( $( compgen -d $cur ) ) fi + COMPREPLY=( $( compgen -d $cur ) ) return 0 }