diff --git a/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, a sh test script should be invoked with the specified shell. b/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, a sh test script should be invoked with the specified shell. index 728fab3..3ba7be7 100755 --- a/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, a sh test script should be invoked with the specified shell. +++ b/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, a sh test script should be invoked with the specified shell. @@ -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 diff --git a/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, a shebang-less test script should be invoked with the specified shell. b/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, a shebang-less test script should be invoked with the specified shell. index 6676bad..74a2aa1 100755 --- a/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, a shebang-less test script should be invoked with the specified shell. +++ b/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, a shebang-less test script should be invoked with the specified shell. @@ -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 diff --git a/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, the TEST_SHELL environment variable should be set to the specified shell too. b/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, the TEST_SHELL environment variable should be set to the specified shell too. index c28b5e1..c10da8e 100755 --- a/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, the TEST_SHELL environment variable should be set to the specified shell too. +++ b/tests/Cross-shell testing/.test-run-by-specified-shell/With -s, the TEST_SHELL environment variable should be set to the specified shell too. @@ -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