added _ifupdown() for Red Hat Linux if{up,down} completion

This commit is contained in:
ianmacd 2002-01-08 00:33:08 +00:00
parent 0ad9c24811
commit 83f81e3130

View File

@ -2,7 +2,7 @@
#
# <![CDATA[
#
# $Id: bash_completion,v 1.50 2002/01/08 01:26:49 ianmacd Exp $
# $Id: bash_completion,v 1.51 2002/01/08 01:33:08 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
@ -471,6 +471,24 @@ _ifconfig()
}
[ $OS = Linux ] && complete -F _ifconfig ifconfig
# RedHat Linux if{up,down} completion by Frank Sweetser <fs@wpi.edu>
#
[ $OS = Linux ] && ( have ifup || have ifdown ) &&
_ifupdown()
{
local cur
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
if [ $COMP_CWORD = 1 ] ; then
COMPREPLY=( $( \ls /etc/sysconfig/network-scripts/ifcfg-* | sed -ne 's/.*ifcfg-\('$cur'.*\)/\1/p' ) )
fi
return 0
}
[ $OS = Linux ] && have ifup && complete -F _ifupdown ifup ifdown
# Linux ipsec(8) completion (for FreeS/WAN). Basic.
#
[ $OS = Linux ] && have ipsec &&