#!/bin/bash # # Usage: # ./shebang.sh is-shell PATH # Test if the first line ends with 'sh'. proc is-shell { local path=$1 local shebang read shebang < $path # read a line from the file setglobal shebang = $(shebang// /) # strip all whitespace on the line [[ $shebang == *sh ]] } proc unittest { for file in [bin/oil.py configure install] { if is-shell $file { echo YES $file } else { echo NO $file } } } @Argv