- avoid tilde expansion where possible, but do interpret the meaning of
~user. This stops 'cd ~us<Tab>' from expanding to 'cd /home/user/'
This commit is contained in:
parent
7be50d3488
commit
f46c3ed6e8
@ -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.368 2002/06/24 08:22:11 ianmacd Exp $
|
# $Id: bash_completion,v 1.369 2002/06/24 16:34:50 ianmacd Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
# Copyright (C) Ian Macdonald <ian@caliban.org>
|
||||||
#
|
#
|
||||||
@ -174,10 +174,7 @@ _expand()
|
|||||||
{
|
{
|
||||||
[ "$cur" != "${cur%\\}" ] && cur="$cur"'\'
|
[ "$cur" != "${cur%\\}" ] && cur="$cur"'\'
|
||||||
|
|
||||||
# expand ~username type directory specifications
|
if [[ "$cur" == \~* ]]; then
|
||||||
if [[ "$cur" == \~*/* ]]; then
|
|
||||||
eval cur=$cur
|
|
||||||
elif [[ "$cur" == \~* ]]; then
|
|
||||||
cur=${cur#\~}
|
cur=${cur#\~}
|
||||||
COMPREPLY=( $( compgen -P '~' -u $cur ) )
|
COMPREPLY=( $( compgen -P '~' -u $cur ) )
|
||||||
return ${#COMPREPLY[@]}
|
return ${#COMPREPLY[@]}
|
||||||
@ -2100,7 +2097,7 @@ _cd()
|
|||||||
for i in ${CDPATH//:/$'\t'}; do
|
for i in ${CDPATH//:/$'\t'}; do
|
||||||
# create an array of matched subdirs
|
# create an array of matched subdirs
|
||||||
k=${#COMPREPLY[@]}
|
k=${#COMPREPLY[@]}
|
||||||
for j in $( compgen -d $i/$cur); do
|
for j in $( compgen -d $i/$cur ); do
|
||||||
COMPREPLY[$k]=${j#$i/}
|
COMPREPLY[$k]=${j#$i/}
|
||||||
k=$((++k))
|
k=$((++k))
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user