]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
bash-completion: simplify pid listing
authorSami Kerola <kerolasa@iki.fi>
Sat, 26 Aug 2017 12:45:13 +0000 (13:45 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 30 Aug 2017 09:21:57 +0000 (11:21 +0200)
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>
bash-completion/nsenter
bash-completion/prlimit
bash-completion/renice
bash-completion/taskset

index ceea6100166aa03e05839c2dc4f4feef56622fd2..ad56f06e4821104a7232480a72e1a09e6c3306d0 100644 (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
                        ;;
index f5e00bb167cab1f0bbf34fed848858801e64d501..fc60c6461011bfb1766998ff2a2b6f4b940a58a9 100644 (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
                        ;;
index c3e9331b0810dfbda5a0e66cb3204e7cc2f14787..2495f37851cd7c6142b7a227ff94557d036fdad6 100644 (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
                        ;;
index 8e62a3b676705d9dfa9fc175beb8e3f77ef0f33f..453b17b4ae655dde73ae095b36e1a02b1f4d97d4 100644 (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
                        ;;