blob: 950dc4a5c3a397ad14077e956865b2f894923d3e (
plain)
1
2
3
4
5
6
7
8
9
|
#!/bin/sh
# TODO: handle "#!/usr/bin/env foo" somehow
while read filename; do
# common cases
sed -n -e '1s:^#![[:space:]]*\(/[^[:space:]]\{1,\}\).*:\1:p' "$filename"
#!/usr/bin/env /foo/bar
sed -n -e '1s:^#![[:space:]]*[^[:space:]]*/bin/env[[:space:]]\{1,\}\(/[^[:space:]]\{1,\}\):\1:p' "$filename"
done
|