But bash doesn't know whether or not the command only respects physical
paths. You have to tell it, and `set -o physical' is the way to do
that.
Ah, I finally understood what 'set -o physical' does. Here's my updated
default programmable completion function for various commands now:
default_complete () {
set -o physical
local t1 t2
COMPREPLY=()
if [[ "$2" == \$\(* ]]
then
t1=${2#??}
COMPREPLY=(`compgen -c -P '$\(' $t1`)
fi
if [ [EMAIL PROTECTED] -eq 0 ] && [[ "$2" == \$\{* ]]
then
t1=${2#??}
COMPREPLY=(`compgen -v -P '${' -S '}' $t1`)
fi
if [ [EMAIL PROTECTED] -eq 0 ] && [[ "$2" == \$* ]]
then
t1=${2#?}
COMPREPLY=(`compgen -v -P '$' $t1`)
fi
if [ [EMAIL PROTECTED] -eq 0 ] && [[ "$2" == ~* ]] && [[ "$2" != */* ]]
then
t1=${2#?}
COMPREPLY=(`compgen -u -P '~' $t1`)
fi
if [ [EMAIL PROTECTED] -eq 0 ] && [[ "$2" == [EMAIL PROTECTED] ]]
then
[EMAIL PROTECTED]
[EMAIL PROTECTED]
COMPREPLY=(`compgen -A hostname -P "${t2}@" $t1`)
fi
if [ [EMAIL PROTECTED] -eq 0 ]
then
# sh-style glob pattern
if [[ $2 == *[*?[]* ]]
then
COMPREPLY=(`compgen -G "$2"`)
# ksh-style extended glob pattern - must be complete
elif shopt -q extglob && [[ $2 == [EMAIL PROTECTED](*\)* ]]
then
COMPREPLY=(`compgen -G "$2"`)
fi
fi
if [ [EMAIL PROTECTED] -eq 0 ]
then
COMPREPLY=(`compgen -f -- "$2"`)
fi
set +o physical
}
complete () {
builtin complete -o default -F default_complete -d $*
}
The new part is the set -o/+o physical. These completions now seem to
work fine for me:
complete ls cp mv
Thanks!
Kartik
_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash