Use awk more to reduce number of invoked commands a bit.

This commit is contained in:
Ville Skyttä 2009-12-21 23:00:31 +02:00
parent 6807b5e72d
commit 3d9f8206e1
5 changed files with 8 additions and 8 deletions

View File

@ -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

View File

@ -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" ) )

View File

@ -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" ) )

View File

@ -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)

View File

@ -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
;;