change ps command to be more portable

This commit is contained in:
Thomas Levine 2016-02-29 02:01:27 +00:00
parent 1752d19e35
commit 1f26a67c9e
3 changed files with 8 additions and 6 deletions

View File

@ -2,8 +2,8 @@
# Assuming that urchin was invoked with `-s bash`, this script should be being run with bash.
this_shell=$(ps -o comm= -p $$ && :)
this_shell=$(ps -o pid,comm | sed -n "s/^ *$$//p" | cut -d\ -f2)
echo "Running shell: $this_shell"
[ "$(basename "$this_shell")" = '.special-shell' ]
basename "$this_shell" | grep .special-shell

View File

@ -1,9 +1,10 @@
# By design, this file has no shebang line.
set -e
# Assuming that urchin was invoked with `-s bash`, this script should be being run with bash.
this_shell=$(ps -o comm= -p $$ && :)
this_shell=$(ps -o pid,comm | sed -n "s/^ *$$//p" | cut -d\ -f2)
echo "Running shell: $this_shell"
[ "$(basename "$this_shell")" = '.special-shell' ]
basename "$this_shell" | grep .special-shell

View File

@ -2,8 +2,9 @@
# Assuming that urchin was invoked with `-s bash`, $TEST_SHELL should contain 'bash'.
echo "Running shell: $(ps -o comm= -p $$ && :)"
this_shell=$(ps -o pid,comm | sed -n "s/^ *$$//p" | cut -d\ -f2)
echo "Running shell: $this_shell"
echo "\$TEST_SHELL: $TEST_SHELL"
[ "$(basename "$this_shell")" = '.special-shell' ]
basename "$this_shell" | grep .special-shell