- _cd(): don't foist the new relative to absolute path conversion on people

who don't use $CDPATH
This commit is contained in:
ianmacd 2002-03-28 22:41:44 +00:00
parent a830c5df6d
commit ab3645b2c0

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05a # bash_completion - some programmable completion functions for bash 2.05a
# #
# $Id: bash_completion,v 1.230 2002/03/28 19:36:19 ianmacd Exp $ # $Id: bash_completion,v 1.231 2002/03/28 23:41:44 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -1703,13 +1703,17 @@ _cd()
fi fi
IFS=$' \t\n' IFS=$' \t\n'
_filedir -d _filedir -d
for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do if [ -n "$CDPATH" ]; then
# remove leading ./ from completions for (( i=0; i < ${#COMPREPLY[@]}; i++ )); do
COMPREPLY[i]=${COMPREPLY[i]#.\/} # remove leading ./ from completions
# turn relative paths from current dir into absolute ones COMPREPLY[i]=${COMPREPLY[i]#.\/}
[[ ${COMPREPLY[i]} != */* ]] && [ -d ${COMPREPLY[i]} ] && \ # turn relative paths from current dir into
COMPREPLY[i]=$PWD/${COMPREPLY[i]} # absolute ones
done [[ ${COMPREPLY[i]} != */* ]] && \
[ -d ${COMPREPLY[i]} ] && \
COMPREPLY[i]=$PWD/${COMPREPLY[i]}
done
fi
return 0 return 0
} }