|
|
@ -194,7 +194,7 @@ _filedir() |
|
|
|
#glob=$(set +o|grep noglob) # save glob setting. |
|
|
|
#glob=$(set +o|grep noglob) # save glob setting. |
|
|
|
#set -f # disable pathname expansion (globbing) |
|
|
|
#set -f # disable pathname expansion (globbing) |
|
|
|
|
|
|
|
|
|
|
|
if [ "${1:-}" = -d ]; then |
|
|
|
if [[ "${1:-}" = -d ]]; then |
|
|
|
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -d -- $cur ) ) |
|
|
|
COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -d -- $cur ) ) |
|
|
|
#eval "$glob" # restore glob setting. |
|
|
|
#eval "$glob" # restore glob setting. |
|
|
|
return 0 |
|
|
|
return 0 |
|
|
@ -256,9 +256,9 @@ _available_interfaces() |
|
|
|
{ |
|
|
|
{ |
|
|
|
local cmd |
|
|
|
local cmd |
|
|
|
|
|
|
|
|
|
|
|
if [ "${1:-}" = -w ]; then |
|
|
|
if [[ "${1:-}" = -w ]]; then |
|
|
|
cmd="iwconfig" |
|
|
|
cmd="iwconfig" |
|
|
|
elif [ "${1:-}" = -a ]; then |
|
|
|
elif [[ "${1:-}" = -a ]]; then |
|
|
|
cmd="ifconfig" |
|
|
|
cmd="ifconfig" |
|
|
|
else |
|
|
|
else |
|
|
|
cmd="ifconfig -a" |
|
|
|
cmd="ifconfig -a" |
|
|
@ -272,7 +272,7 @@ _available_interfaces() |
|
|
|
# |
|
|
|
# |
|
|
|
_expand() |
|
|
|
_expand() |
|
|
|
{ |
|
|
|
{ |
|
|
|
[ "$cur" != "${cur%\\}" ] && cur="$cur\\" |
|
|
|
[[ "$cur" != "${cur%\\}" ]] && cur="$cur\\" |
|
|
|
|
|
|
|
|
|
|
|
# expand ~username type directory specifications |
|
|
|
# expand ~username type directory specifications |
|
|
|
if [[ "$cur" == \~*/* ]]; then |
|
|
|
if [[ "$cur" == \~*/* ]]; then |
|
|
@ -455,7 +455,7 @@ _function() |
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]} |
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]} |
|
|
|
|
|
|
|
|
|
|
|
if [[ $1 == @(declare|typeset) ]]; then |
|
|
|
if [[ $1 == @(declare|typeset) ]]; then |
|
|
|
if [ "$prev" = -f ]; then |
|
|
|
if [[ "$prev" = -f ]]; then |
|
|
|
COMPREPLY=( $( compgen -A function -- $cur ) ) |
|
|
|
COMPREPLY=( $( compgen -A function -- $cur ) ) |
|
|
|
elif [[ "$cur" == -* ]]; then |
|
|
|
elif [[ "$cur" == -* ]]; then |
|
|
|
COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \ |
|
|
|
COMPREPLY=( $( compgen -W '-a -f -F -i -r -x -p' -- \ |
|
|
@ -527,7 +527,7 @@ complete -F _complete complete |
|
|
|
# start of section containing completion functions for external programs |
|
|
|
# start of section containing completion functions for external programs |
|
|
|
|
|
|
|
|
|
|
|
# a little help for FreeBSD ports users |
|
|
|
# a little help for FreeBSD ports users |
|
|
|
[ $UNAME = FreeBSD ] && complete -W 'index search fetch fetch-list \ |
|
|
|
[[ $UNAME = FreeBSD ]] && complete -W 'index search fetch fetch-list \ |
|
|
|
extract patch configure build install reinstall \ |
|
|
|
extract patch configure build install reinstall \ |
|
|
|
deinstall clean clean-depends kernel buildworld' make |
|
|
|
deinstall clean clean-depends kernel buildworld' make |
|
|
|
|
|
|
|
|
|
|
@ -717,8 +717,8 @@ _insmod() |
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]} |
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]} |
|
|
|
|
|
|
|
|
|
|
|
# behave like lsmod for modprobe -r |
|
|
|
# behave like lsmod for modprobe -r |
|
|
|
if [ $1 = "modprobe" ] && |
|
|
|
if [[ $1 = "modprobe" ]] && |
|
|
|
[ "${COMP_WORDS[1]}" = "-r" ]; then |
|
|
|
[[ "${COMP_WORDS[1]}" = "-r" ]]; then |
|
|
|
COMPREPLY=( $( /sbin/lsmod | \ |
|
|
|
COMPREPLY=( $( /sbin/lsmod | \ |
|
|
|
awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) ) |
|
|
|
awk '{if (NR != 1 && $1 ~ /^'$cur'/) print $1}' ) ) |
|
|
|
return 0 |
|
|
|
return 0 |
|
|
@ -748,8 +748,8 @@ complete -F _insmod $filenames insmod modprobe modinfo |
|
|
|
# man(1) completion |
|
|
|
# man(1) completion |
|
|
|
# |
|
|
|
# |
|
|
|
[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \ |
|
|
|
[ $UNAME = GNU -o $UNAME = Linux -o $UNAME = Darwin \ |
|
|
|
-o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \ |
|
|
|
-o $UNAME = FreeBSD -o $UNAME = SunOS -o $UNAME = Cygwin \ |
|
|
|
-o $UNAME = OpenBSD ] && |
|
|
|
-o $UNAME = OpenBSD ] && |
|
|
|
_man() |
|
|
|
_man() |
|
|
|
{ |
|
|
|
{ |
|
|
|
local cur prev sect manpath UNAME |
|
|
|
local cur prev sect manpath UNAME |
|
|
@ -993,8 +993,8 @@ _find() |
|
|
|
-noleaf -version -xdev ' |
|
|
|
-noleaf -version -xdev ' |
|
|
|
COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \ |
|
|
|
COMPREPLY=( $( echo "${COMP_WORDS[@]}" | \ |
|
|
|
(while read -d ' ' i; do |
|
|
|
(while read -d ' ' i; do |
|
|
|
[ "$i" == "" ] || |
|
|
|
[[ "$i" == "" ]] || |
|
|
|
[ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ] && |
|
|
|
[[ "${onlyonce/ ${i%% *} / }" == "$onlyonce" ]] && |
|
|
|
continue |
|
|
|
continue |
|
|
|
# flatten array with spaces on either side, |
|
|
|
# flatten array with spaces on either side, |
|
|
|
# otherwise we cannot grep on word boundaries of |
|
|
|
# otherwise we cannot grep on word boundaries of |
|
|
@ -2338,7 +2338,7 @@ _chsh() |
|
|
|
cur=${COMP_WORDS[COMP_CWORD]} |
|
|
|
cur=${COMP_WORDS[COMP_CWORD]} |
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]} |
|
|
|
prev=${COMP_WORDS[COMP_CWORD-1]} |
|
|
|
|
|
|
|
|
|
|
|
if [ "$prev" = "-s" ]; then |
|
|
|
if [[ "$prev" = "-s" ]]; then |
|
|
|
if [ -f /etc/debian_version ]; then |
|
|
|
if [ -f /etc/debian_version ]; then |
|
|
|
COMPREPLY=( $( </etc/shells ) ) |
|
|
|
COMPREPLY=( $( </etc/shells ) ) |
|
|
|
else |
|
|
|
else |
|
|
@ -9283,7 +9283,7 @@ if [ -d $BASH_COMPLETION_DIR -a -r $BASH_COMPLETION_DIR -a \ |
|
|
|
-x $BASH_COMPLETION_DIR ]; then |
|
|
|
-x $BASH_COMPLETION_DIR ]; then |
|
|
|
for i in $BASH_COMPLETION_DIR/*; do |
|
|
|
for i in $BASH_COMPLETION_DIR/*; do |
|
|
|
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|.rpm*) ]] && |
|
|
|
[[ ${i##*/} != @(*~|*.bak|*.swp|\#*\#|*.dpkg*|.rpm*) ]] && |
|
|
|
[ \( -f $i -o -h $i \) -a -r $i ] && . $i |
|
|
|
[ \( -f $i -o -h $i \) -a -r $i ] && . $i 2>&- |
|
|
|
done |
|
|
|
done |
|
|
|
fi |
|
|
|
fi |
|
|
|
unset i |
|
|
|
unset i |
|
|
|