| 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'. | 
| 7 | is-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 | |
| 15 | unittest() { | 
| 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 |