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

View File

@ -254,7 +254,7 @@ _cvs()
cvsroot)
if [ -r ~/.cvspass ]; then
# 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" ) )
fi
;;

View File

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

View File

@ -17,7 +17,8 @@ _gpg()
--@(export|@(?(l|nr|nrl)sign|edit)-key))
# return list of public keys
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
;;
-@(r|-recipient))

View File

@ -21,7 +21,8 @@ _gpg2 ()
--@(export|@(?(l|nr|nrl)sign|edit)-key))
# return list of public keys
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
;;
-@(r|-recipient))

View File

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