I'm learning awk
today, but I cannot succeed in having the most simple scripts to work.
#!/usr/bin/env -S awk -f
BEGIN { }
{ }
END { }
this outputs BEGIN: command not found
or even
#!/usr/bin/env -S awk -f
{}
this outputs {}: command not found
When I launch $ /usr/bin/env -S awk -f
, I do have the awk executable that display its default output.
And $ awk --version
says it's awk version 5.0.1 , on nixos 19.09.
I need to use /usr/bin/env
, because nixos files are not following the traditionnal FHS directory hierarchy.
I suspect I'm missing something obvious but looking awk tutorials and SO questions has not given me any clue for now.
EDIT: the command line I use to launch the script
ls -l | . testawk.sh
#!
-line like#!/usr/bin/awk -f
? Very few Unices can handle#!
-lines with more than a single argument (yours have three)./run/current-system/sw/bin/awk
. So it cannot work.~$ ./scriptname.sh
?