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
|
||||
|
||||
if [[ -n "$sm" && "$cur" == *:* ]]; then
|
||||
COMPREPLY=( $( compgen -W "$( $sm -e ${cur%%:*} | sed 1d | \
|
||||
awk '{print $1}' )" -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W "$( $sm -e ${cur%%:*} | \
|
||||
awk 'NR>1 {print $1}' )" -- "$cur" ) )
|
||||
elif [[ "$cur" == //* ]]; then
|
||||
host=${cur#//}
|
||||
host=${host%%/*}
|
||||
@ -1371,7 +1371,7 @@ _known_hosts_real()
|
||||
COMPREPLY=( "${COMPREPLY[@]}" $( \
|
||||
compgen -P "$prefix$user" -S "$suffix" -W \
|
||||
"$( avahi-browse -cpr _workstation._tcp 2>/dev/null | \
|
||||
command grep ^= | cut -d\; -f7 | sort -u )" -- "$cur" ) )
|
||||
awk -F\; '/^=/ { print $7 }' | sort -u )" -- "$cur" ) )
|
||||
fi
|
||||
|
||||
# Add results of normal hostname completion, unless
|
||||
|
@ -7,7 +7,7 @@ _apache2ctl() {
|
||||
COMPREPLY=()
|
||||
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 "|" " ")
|
||||
|
||||
COMPREPLY=( $( compgen -W "$APWORDS" -- "$cur" ) )
|
||||
|
@ -7,7 +7,7 @@ _bk() {
|
||||
COMPREPLY=()
|
||||
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 ' )"
|
||||
|
||||
COMPREPLY=( $( compgen -W "$BKCMDS" -- "$cur" ) )
|
||||
|
@ -21,8 +21,8 @@ _brctl()
|
||||
show)
|
||||
;;
|
||||
*)
|
||||
COMPREPLY=( $( compgen -W "$(brctl show | sed '1d' | \
|
||||
awk '{print $1}' )" -- "$cur" ) )
|
||||
COMPREPLY=( $( compgen -W "$(brctl show | \
|
||||
awk 'NR>1 {print $1}' )" -- "$cur" ) )
|
||||
esac
|
||||
;;
|
||||
3)
|
||||
|
@ -10,7 +10,7 @@ _xrandr()
|
||||
|
||||
case "$prev" in
|
||||
--output)
|
||||
local outputs=$(xrandr|command grep 'connected'|awk '{print $1}')
|
||||
local outputs=$(xrandr|awk '/connected/ {print $1}')
|
||||
COMPREPLY=( $(compgen -W "$outputs" -- "$cur"))
|
||||
return 0
|
||||
;;
|
||||
|
Loading…
x
Reference in New Issue
Block a user