check that $modpath directory can be entered in _insmod()

This commit is contained in:
ianmacd 2002-02-18 17:36:00 +00:00
parent c3562cad68
commit 0d6c8060b2

View File

@ -1,6 +1,6 @@
# bash_completion - some programmable completion functions for bash 2.05a
#
# $Id: bash_completion,v 1.127 2002/02/18 18:26:54 ianmacd Exp $
# $Id: bash_completion,v 1.128 2002/02/18 18:36:00 ianmacd Exp $
#
# Copyright (C) Ian Macdonald <ian@caliban.org>
#
@ -264,10 +264,12 @@ _insmod()
# do module parameter completion
COMPREPLY=( $( /sbin/modinfo -p ${COMP_WORDS[1]} | \
awk '{if ($1 ~ /^'$cur'/) print $1}' ) )
else
elif [ -r $modpath -a -x $modpath ]; then
# do module name completion
COMPREPLY=( $( \ls -R $modpath | \
sed -ne 's/^\('$cur'.*\)\.o$/\1/p') )
else
COMPREPLY=( $( compgen -f $cur ) )
fi
return 0
@ -364,7 +366,7 @@ _killall()
fi
# get processes, adding to signals if applicable
COMPREPLY=( ${COMPREPLY[*]} $( ps ahx | sed -e 's#[]\[()]##g' | \
COMPREPLY=( ${COMPREPLY[@]} $( ps ahx | sed -e 's#[]\[()]##g' | \
awk '{p=$5;sub("^.*/","",p);if (p ~ /^'$cur'/) print $5}' | \
sed -e 's#^.*/##' ))
return 0