Avoid sed pipe as ps itself can omit the headers (thanks to Elan Ruusamäe)

This commit is contained in:
David Paleino 2009-09-17 22:15:13 +02:00
parent 7bc1813148
commit f13ea4968b
2 changed files with 6 additions and 4 deletions

View File

@ -36,6 +36,8 @@ bash-completion (1.x)
* Improve qemu completion (Debian: #534901) * Improve qemu completion (Debian: #534901)
* Added sshfs completion (shares the same as scp) (Debian: #545978) * Added sshfs completion (shares the same as scp) (Debian: #545978)
* Fixed obvious brokenness (typos) in contrib/mdadm * Fixed obvious brokenness (typos) in contrib/mdadm
* Patches from PLD Linux (thanks to Elan Ruusamäe):
- avoid sed pipe as ps itself can omit the headers
[ Ville Skyttä ] [ Ville Skyttä ]
* Split yum completion to contrib/_yum (no longer installed by default, the * Split yum completion to contrib/_yum (no longer installed by default, the

View File

@ -445,7 +445,7 @@ _pids()
} || } ||
_pids() _pids()
{ {
COMPREPLY=( $( compgen -W '$( command ps axo pid | sed 1d )' -- $cur ) ) COMPREPLY=( $( compgen -W '$( command ps axo pid= )' -- $cur ) )
} }
# This function completes on process group IDs. # This function completes on process group IDs.
@ -457,7 +457,7 @@ _pgids()
} || } ||
_pgids() _pgids()
{ {
COMPREPLY=( $( compgen -W '$( command ps axo pgid | sed 1d )' -- $cur )) COMPREPLY=( $( compgen -W '$( command ps axo pgid= )' -- $cur ))
} }
# This function completes on process names. # This function completes on process names.
@ -480,8 +480,8 @@ _pnames()
# for now. # for now.
# 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 "1d; s/ .*//; s:.*/::; s/:$//;" \ sed -e "s/ .*//; s:.*/::; s/:$//;" \
-e "s/^[[(-]//; s/[])]$//" \ -e "s/^[[(-]//; s/[])]$//" \
-e "s/^<defunct>$//")' \ -e "s/^<defunct>$//")' \
-- $cur ) ) -- $cur ) )