Quantcast
Viewing all articles
Browse latest Browse all 6

How to print own script name in mawk?

In bash $0 contains the name of the script, but in awk if I make a script named myscript.awk with the following content:

#!/usr/bin/awk -f
BEGIN{ print ARGV[0] }

and run it, it will only print "awk". Besides, ARGV[i] with i>0 is used only for script arguments in command line. So, how to make it print the name of the script, in this case "myscript.awk"?


Viewing all articles
Browse latest Browse all 6

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>