- avoid errors when comp{gen,lete} -g don't work on an unpatched bash 2.05

This commit is contained in:
ianmacd 2002-04-14 22:41:04 +00:00
parent dbda779d38
commit ad561ac1ca

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.267 2002/04/13 19:24:28 ianmacd Exp $ # $Id: bash_completion,v 1.268 2002/04/15 00:41:04 ianmacd Exp $
# #
# Copyright (C) Ian Macdonald <ian@caliban.org> # Copyright (C) Ian Macdonald <ian@caliban.org>
# #
@ -84,7 +84,7 @@ complete -f -X '!*.@(exe|EXE|com|COM)' wine
complete -u finger su usermod userdel passwd chage write talk chfn complete -u finger su usermod userdel passwd chage write talk chfn
# group commands see only groups # group commands see only groups
[ ${BASH_VERSINFO[1]} '>' 04 ] && complete -g groupmod groupdel [ ${BASH_VERSINFO[1]} '>' 04 ] && complete -g groupmod groupdel 2>/dev/null
# bg completes with stopped jobs # bg completes with stopped jobs
complete -A stopped -P '%' bg complete -A stopped -P '%' bg
@ -276,7 +276,8 @@ _chown()
[ ${BASH_VERSINFO[1]} '>' 04 ]; then [ ${BASH_VERSINFO[1]} '>' 04 ]; then
user=${cur%%?(\\)[.:]*} user=${cur%%?(\\)[.:]*}
group=${cur#*[.:]} group=${cur#*[.:]}
COMPREPLY=( $( compgen -P $user'\:' -g -- $group ) ) COMPREPLY=( $( compgen -P $user'\:' \
-g -- $group 2>/dev/null) )
else else
COMPREPLY=( $( compgen -S '\:' -u $cur ) ) COMPREPLY=( $( compgen -S '\:' -u $cur ) )
fi fi
@ -300,7 +301,7 @@ _chgrp()
if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \ if [ $COMP_CWORD -eq 1 ] && [[ "$cur" != -* ]] || \
[[ "$prev" == -* ]]; then [[ "$prev" == -* ]]; then
[ ${BASH_VERSINFO[1]} '>' 04 ] && \ [ ${BASH_VERSINFO[1]} '>' 04 ] && \
COMPREPLY=( $( compgen -g $cur ) ) COMPREPLY=( $( compgen -g $cur 2>/dev/null) )
else else
_expand || return 0 _expand || return 0
fi fi
@ -574,7 +575,7 @@ _find()
;; ;;
-group) -group)
[ ${BASH_VERSINFO[1]} '>' 04 ] && \ [ ${BASH_VERSINFO[1]} '>' 04 ] && \
COMPREPLY=( $( compgen -g -- $cur ) ) COMPREPLY=( $( compgen -g -- $cur 2>/dev/null) )
return 0 return 0
;; ;;
-?(x)type) -?(x)type)