OILS / test / shebang.sh View on Github | oilshell.org

26 lines, 16 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# test/shebang.sh is-shell PATH
5
6# Test if the first line ends with 'sh'.
7is-shell() {
8 local path=$1
9 local shebang
10 read shebang < "$path" # read a line from the file
11 shebang=${shebang// /} # strip all whitespace on the line
12 [[ $shebang == *sh ]]
13}
14
15unittest() {
16 for file in bin/oil.py configure install; do
17 if is-shell $file; then
18 echo YES $file
19 else
20 echo NO $file
21 fi
22 done
23}
24
25"$@"
26