How to use multiple arguments for awk with a shebang (i.e. #!)?

前端 未结 10 879
小蘑菇
小蘑菇 2020-11-22 17:42

I\'d like to execute an gawk script with --re-interval using a shebang. The \"naive\" approach of

#!/usr/bin/gawk --re-interval -f
... awk scri         


        
10条回答
  •  被撕碎了的回忆
    2020-11-22 17:53

    In the gawk manual (http://www.gnu.org/manual/gawk/gawk.html), the end of section 1.14 note that you should only use a single argument when running gawk from a shebang line. It says that the OS will treat everything after the path to gawk as a single argument. Perhaps there is another way to specify the --re-interval option? Perhaps your script can reference your shell in the shebang line, run gawk as a command, and include the text of your script as a "here document".

提交回复
热议问题