From ceaf1bc92d83b2b0262a0136a9111ef208e814f4 Mon Sep 17 00:00:00 2001 From: Thomas Levine <_@thomaslevine.com> Date: Mon, 29 Feb 2016 05:10:53 +0000 Subject: [PATCH] check for lacking shebang line, only --- urchin | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/urchin b/urchin index 0b33f01..25851bf 100755 --- a/urchin +++ b/urchin @@ -192,8 +192,7 @@ recurse() { start=$(date +%s) set +e { - if $cycle_shell && - has_sh_or_no_shebang_line "$potential_test"; then + if $cycle_shell && ! has_shebang_line "$potential_test"; then TEST_SHELL="$the_test_shell" $TIMEOUT \ "$the_test_shell" "$potential_test" else @@ -362,15 +361,8 @@ report_outcome() { test "$not_oks" -eq '0' } -has_sh_or_no_shebang_line() { - # no shebang line at all - 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 +has_shebang_line() { + head -n 1 "$1" | grep -qE '^#!' } USAGE="usage: $0 [] "