Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 6
    You manually feed the name of the script in it, this is not a self-printing way Commented Sep 7, 2015 at 16:33
  • 1
    @cipper: Well, that's the easiest and portable way I can imagine. Commented Sep 7, 2015 at 16:34
  • 6
    It's like calling awk -vNAME="myscript.awk" ./myscript.awk and then print the variable NAME inside the script. Not a solution. Commented Sep 8, 2015 at 6:59
  • @cipper: That's the only way, if you mention mawk. And also using ENVIRON isn't the same as using -vNAME="myscript.awk", since when mawk will expand escape sequence in NAME. Commented Sep 8, 2015 at 7:08