bash-completion: simplify pid listing

Changing directory in subshell does not effect parent process, so this is
better and possibly quicker way to list pids.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2017-08-26 13:45:13 +01:00 committed by Karel Zak
parent 473ec35974
commit 75c5f4a516
4 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@ _nsenter_module()
;;
'-t'|'--target')
local PIDS
PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
PIDS=$(cd /proc && echo [0-9]*)
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
return 0
;;

View File

@ -6,7 +6,7 @@ _prlimit_module()
prev="${COMP_WORDS[COMP_CWORD-1]}"
case $prev in
'-p'|'--pid')
PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
PIDS=$(cd /proc && echo [0-9]*)
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
return 0
;;

View File

@ -17,7 +17,7 @@ _renice_module()
;;
'-p'|'--pid')
local PIDS
PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
PIDS=$(cd /proc && echo [0-9]*)
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
return 0
;;

View File

@ -25,7 +25,7 @@ _taskset_module()
# setting an affinity the optarg has to be cpu
# mask. The following is good only for getting
# affinity.
PIDS=$(for I in /proc/[0-9]*; do echo ${I##"/proc/"}; done)
PIDS=$(cd /proc && echo [0-9]*)
COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
return 0
;;