Closed IsaacG closed 2 years ago
» head -n1 leap.awk #!/usr/bin/env gawk -f » chmod 755 leap.awk » ./leap.awk <<< 2 /usr/bin/env: ‘gawk -f’: No such file or directory /usr/bin/env: use -[v]S to pass options in shebang lines # Modified shebang: » head -n1 leap.awk #!/usr/bin/env -S gawk -f » ./leap.awk <<< 2 false
The shebang #!/usr/bin/env gawk -f is completely broken. "According to POSIX, the hashbang can have one argument." (see SO).
#!/usr/bin/env gawk -f
Our options here are (1) hard code a /usr/bin/gawk path or (2) rely on GNU env and -S or (3) drop the shebang and not rely on it.
/usr/bin/gawk
env
-S
See also Wikipedia and netbsd mail list
@glennj Thoughts?
/usr/bin/env: unrecognized option: S
I'd bet that 99.9% of students will have env -S. But probably best to just drop it. Maybe document it ... somewhere.
The shebang
#!/usr/bin/env gawk -f
is completely broken. "According to POSIX, the hashbang can have one argument." (see SO).Our options here are (1) hard code a
/usr/bin/gawk
path or (2) rely on GNUenv
and-S
or (3) drop the shebang and not rely on it.See also Wikipedia and netbsd mail list
@glennj Thoughts?