- fix for sudo completion when subcommand is passed wildcard globs

(patch by Lucien Saviot <Lucien.Saviot@u-bourgogne.fr>)
This commit is contained in:
ianmacd 2003-04-19 05:43:41 +00:00
parent 116db06fd4
commit ee17c45627

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05b
#
# $Id: bash_completion,v 1.546 2003/04/19 01:12:37 ianmacd Exp $
# $Id: bash_completion,v 1.547 2003/04/19 07:43:41 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
@ -2451,11 +2451,16 @@ fi
#
_command()
{
local cur func cline cspec
local cur func cline cspec noglob
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
# save noglob state
shopt -o noglob >/dev/null; noglob=$?
# turn on noglob, as things like 'sudo ls *<Tab>' don't work otherwise
shopt -so noglob
if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=( $( compgen -c -- $cur ) )
elif complete -p ${COMP_WORDS[1]} &>/dev/null; then
@ -2500,6 +2505,9 @@ _command()
fi
[ ${#COMPREPLY[@]} -eq 0 ] && _filedir
# reset noglob if necessary
[ $noglob -eq 1 ] && shopt -uo noglob
}
complete -F _command $filenames nohup exec nice eval strace time ltrace then \
else do