sed usage portability fixes: avoid semicolon separated statements in one -e.

This commit is contained in:
Ville Skyttä 2009-11-04 00:16:06 +02:00
parent ef46331012
commit 41c675e749
6 changed files with 12 additions and 10 deletions

View File

@ -594,8 +594,8 @@ _pnames()
# Not using "ps axo comm" because under some Linux kernels, it # Not using "ps axo comm" because under some Linux kernels, it
# truncates command names (see e.g. http://bugs.debian.org/497540#19) # truncates command names (see e.g. http://bugs.debian.org/497540#19)
COMPREPLY=( $( compgen -W '$( command ps axo command= | \ COMPREPLY=( $( compgen -W '$( command ps axo command= | \
sed -e "s/ .*//; s:.*/::; s/:$//;" \ sed -e "s/ .*//" -e "s:.*/::" -e "s/:$//" \
-e "s/^[[(-]//; s/[])]$//" \ -e "s/^[[(-]//" -e "s/[])]$//" \
-e "s/^<defunct>$//")' \ -e "s/^<defunct>$//")' \
-- "$cur" ) ) -- "$cur" ) )
} }
@ -767,8 +767,8 @@ _service()
if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then if [[ $COMP_CWORD -eq 1 ]] && [[ $prev == "service" ]]; then
_services _services
else else
COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \ COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \ -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" \
$sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) ) $sysvdir/${prev##*/} 2>/dev/null`' -- "$cur" ) )
fi fi

View File

@ -254,7 +254,7 @@ _cvs()
cvsroot) cvsroot)
if [ -r ~/.cvspass ]; then if [ -r ~/.cvspass ]; then
# Ugly escaping because of bash treating ':' specially # Ugly escaping because of bash treating ':' specially
cvsroots=$( sed 's/^[^ ]* //; s/:/\\:/g' ~/.cvspass ) cvsroots=$( sed -e 's/^[^ ]* //' -e 's/:/\\:/g' ~/.cvspass )
COMPREPLY=( $( compgen -W '$cvsroots' -- "$cur" ) ) COMPREPLY=( $( compgen -W '$cvsroots' -- "$cur" ) )
fi fi
;; ;;

View File

@ -21,7 +21,7 @@ _gdb()
# names manually. # names manually.
IFS=":" IFS=":"
local path_array=( $( echo "$PATH" | \ local path_array=( $( echo "$PATH" | \
sed 's/:\{2,\}/:/g;s/^:\|:$//g' ) ) sed -e 's/:\{2,\}/:/g' -e 's/^:\|:$//g' ) )
IFS=$'\n' IFS=$'\n'
COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \ COMPREPLY=( $( compgen -d -W '$(find "${path_array[@]}" . \
-mindepth 1 -maxdepth 1 -not -type d -executable \ -mindepth 1 -maxdepth 1 -not -type d -executable \

View File

@ -17,7 +17,8 @@ _gpg()
--@(export|@(?(l|nr|nrl)sign|edit)-key)) --@(export|@(?(l|nr|nrl)sign|edit)-key))
# return list of public keys # return list of public keys
COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \ COMPREPLY=( $( compgen -W "$( gpg --list-keys 2>/dev/null | \
sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" )) sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' \
-ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) )
return 0 return 0
;; ;;
-@(r|-recipient)) -@(r|-recipient))

View File

@ -21,7 +21,8 @@ _gpg2 ()
--@(export|@(?(l|nr|nrl)sign|edit)-key)) --@(export|@(?(l|nr|nrl)sign|edit)-key))
# return list of public keys # return list of public keys
COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \ COMPREPLY=( $( compgen -W "$( gpg2 --list-keys 2>/dev/null | \
sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p;s@^.*\(<\([^>]*\)>\).*$@\2@p')" -- "$cur" )) sed -ne 's@^pub.*/\([^ ]*\).*$@\1@p' \
-ne 's@^.*\(<\([^>]*\)>\).*$@\2@p' )" -- "$cur" ) )
return 0 return 0
;; ;;
-@(r|-recipient)) -@(r|-recipient))

View File

@ -93,8 +93,8 @@ _invoke_rc_d()
) ) ) )
COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" ) ) COMPREPLY=( $( compgen -W '${valid_options[@]} ${services[@]}' -- "$cur" ) )
elif [ -x $sysvdir/$prev ]; then elif [ -x $sysvdir/$prev ]; then
COMPREPLY=( $( compgen -W '`sed -ne "y/|/ /; \ COMPREPLY=( $( compgen -W '`sed -e "y/|/ /" \
s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \ -ne "s/^.*Usage:[ ]*[^ ]*[ ]*{*\([^}\"]*\).*$/\1/p" \
$sysvdir/$prev`' -- "$cur" ) ) $sysvdir/$prev`' -- "$cur" ) )
else else
COMPREPLY=() COMPREPLY=()