[Home]
HomePage RecentChanges Frequently Asked Questions

command line parameter

The awk extraction and reporting language uses traditional conventions for accessing command line parameters. The command line arguments are stored in the [[array?]] ARGV, and the number of parameters are stored in the [[scalar?]] variable ARGC.

 #!/usr/bin/awk -f
 
 BEGIN {
 print "There are " ARGC "command line parameters"
 for(l=1; l<ARGC; l++) {
 print "Argument " l " is " ARGV[l]
 }
 }

The value of ARGV[0] is unreliable and varies across systems

By convention ARGV[0] contains the name of the [[script?]] being utilized. However, this behaviour is not reliable and it is not consistent across systems. Some systems may report the name of the awk interpreter, rather than the name of the [[script?]] or [[pathname?]] components may be included.


Edit this page View other revisions Administration
Last edited 2011年06月25日 05:49 UTC by pgas (diff)

Powered by sdf Creative Commons License <pierre.gaston+awk@gmail.com>

Awk Wiki by #awk is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

AltStyle によって変換されたページ (->オリジナル) /