check for lacking shebang line, only

This commit is contained in:
Thomas Levine 2016-02-29 05:10:53 +00:00
parent 32a2247292
commit ceaf1bc92d

14
urchin
View File

@ -192,8 +192,7 @@ recurse() {
start=$(date +%s) start=$(date +%s)
set +e set +e
{ {
if $cycle_shell && if $cycle_shell && ! has_shebang_line "$potential_test"; then
has_sh_or_no_shebang_line "$potential_test"; then
TEST_SHELL="$the_test_shell" $TIMEOUT \ TEST_SHELL="$the_test_shell" $TIMEOUT \
"$the_test_shell" "$potential_test" "$the_test_shell" "$potential_test"
else else
@ -362,15 +361,8 @@ report_outcome() {
test "$not_oks" -eq '0' test "$not_oks" -eq '0'
} }
has_sh_or_no_shebang_line() { has_shebang_line() {
# no shebang line at all head -n 1 "$1" | grep -qE '^#!'
head -n 1 "$1" | grep -vqE '^#!' && return 0
# shebang line is '#!/bin/sh' or legal variations thereof
head -n 1 "$1" | grep -qE '^#![[:blank:]]*/bin/sh($|[[:blank:]])' &&
return 0
return 1
} }
USAGE="usage: $0 [<options>] <test directory>" USAGE="usage: $0 [<options>] <test directory>"