39 lines
716 B
Plaintext
Raw Normal View History

# bash completion for FreeBSD kernel module commands
[ $UNAME = FreeBSD ] &&
{
_kldload()
{
2009-10-04 19:42:50 +02:00
local cur moddir
2009-10-04 19:42:50 +02:00
moddir=/modules/
[ -d $moddir ] || moddir=/boot/kernel/
cur=`_get_cword`
2009-10-04 19:42:50 +02:00
COMPREPLY=( $( compgen -f "$moddir$cur" ) )
COMPREPLY=( ${COMPREPLY[@]#$moddir} )
COMPREPLY=( ${COMPREPLY[@]%.ko} )
2009-10-04 19:42:50 +02:00
return 0
}
complete -F _kldload -o filenames kldload
_kldunload()
{
2009-10-04 19:42:50 +02:00
local cur
cur=`_get_cword`
COMPREPLY=( $(kldstat | sed -ne "s/^.*[ \t]\+\($cur[a-z_]\+\).ko$/\1/p") )
}
complete -F _kldunload -o filenames kldunload
}
# Local variables:
# mode: shell-script
2009-10-04 19:42:50 +02:00
# sh-basic-offset: 4
# sh-indent-comment: t
2009-10-04 19:42:50 +02:00
# indent-tabs-mode: nil
# End:
2009-10-04 19:42:50 +02:00
# ex: ts=4 sw=4 et filetype=sh