1

Linux shylock-archinux 4.15.15-1-ARCH #1 SMP PREEMPT Sat Mar 31 23:59:25 UTC 2018 x86_64 GNU/Linux

My machine is above.Anyone know what happend?

The script with shebang #! /usr/bin/env awk -f don't work?I call it by ./script.awk inputfile,it should be same as manually call awk -f ./script.awk inputfile,but only the latter work well!

which awk output /usr/bin/awk.

1 Answers1

1

The shebang line typically only takes at most two arguments, so it's considering "awk -f" as a single argument to env.

Considering you know the path to your awk, using that directly should fix the problem for you:

#! /usr/bin/awk -f

See also https://stackoverflow.com/a/4304187/9447571 for a few more details on how shebang arguments are recognized.

filbranden
  • 21,751
  • 4
  • 63
  • 86