Use awk more to reduce number of invoked commands a bit.
This commit is contained in:
parent
6807b5e72d
commit
3d9f8206e1
@ -939,8 +939,8 @@ _mount()
|
|||||||
for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done
|
for i in {,/usr}/{,s}bin/showmount; do [ -x $i ] && sm=$i && break; done
|
||||||
|
|
||||||
if [[ -n "$sm" && "$cur" == *:* ]]; then
|
if [[ -n "$sm" && "$cur" == *:* ]]; then
|
||||||
COMPREPLY=( $( compgen -W "$( $sm -e ${cur%%:*} | sed 1d | \
|
COMPREPLY=( $( compgen -W "$( $sm -e ${cur%%:*} | \
|
||||||
awk '{print $1}' )" -- "$cur" ) )
|
awk 'NR>1 {print $1}' )" -- "$cur" ) )
|
||||||
elif [[ "$cur" == //* ]]; then
|
elif [[ "$cur" == //* ]]; then
|
||||||
host=${cur#//}
|
host=${cur#//}
|
||||||
host=${host%%/*}
|
host=${host%%/*}
|
||||||
@ -1371,7 +1371,7 @@ _known_hosts_real()
|
|||||||
COMPREPLY=( "${COMPREPLY[@]}" $( \
|
COMPREPLY=( "${COMPREPLY[@]}" $( \
|
||||||
compgen -P "$prefix$user" -S "$suffix" -W \
|
compgen -P "$prefix$user" -S "$suffix" -W \
|
||||||
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
|
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
|
||||||
command grep ^= | cut -d\; -f7 | sort -u )" -- "$cur" ) )
|
awk -F\; '/^=/ { print $7 }' | sort -u )" -- "$cur" ) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add results of normal hostname completion, unless
|
# Add results of normal hostname completion, unless
|
||||||
|
@ -7,7 +7,7 @@ _apache2ctl() {
|
|||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=`_get_cword`
|
cur=`_get_cword`
|
||||||
|
|
||||||
APWORDS=$(apache2ctl 2>&1 >/dev/null | head -n1 | cut -f3 -d" " | \
|
APWORDS=$(apache2ctl 2>&1 >/dev/null | awk 'NR<2 { print $3; exit }' | \
|
||||||
tr "|" " ")
|
tr "|" " ")
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) )
|
||||||
|
@ -7,7 +7,7 @@ _bk() {
|
|||||||
COMPREPLY=()
|
COMPREPLY=()
|
||||||
cur=`_get_cword`
|
cur=`_get_cword`
|
||||||
|
|
||||||
BKCMDS="$( bk help topics | command grep '^ bk' | cut -d ' ' -f 4 | \
|
BKCMDS="$( bk help topics | awk '/^ bk/ { print $4 }' | \
|
||||||
xargs printf '%s ' )"
|
xargs printf '%s ' )"
|
||||||
|
|
||||||
COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
|
COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
|
||||||
|
@ -21,8 +21,8 @@ _brctl()
|
|||||||
show)
|
show)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
COMPREPLY=( $( compgen -W "$(brctl show | sed '1d' | \
|
COMPREPLY=( $( compgen -W "$(brctl show | \
|
||||||
awk '{print $1}' )" -- "$cur" ) )
|
awk 'NR>1 {print $1}' )" -- "$cur" ) )
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
|
@ -10,7 +10,7 @@ _xrandr()
|
|||||||
|
|
||||||
case "$prev" in
|
case "$prev" in
|
||||||
--output)
|
--output)
|
||||||
local outputs=$(xrandr|command grep 'connected'|awk '{print $1}')
|
local outputs=$(xrandr|awk '/connected/ {print $1}')
|
||||||
COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
|
COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user