diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2015-05-15 09:20:13 -0400 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2015-05-15 09:20:13 -0400 |
commit | 681a5d8b52b7c5725c54bdab507c3c63effad142 (patch) | |
tree | d14808f1c9e8f02514ac68295391c13d4361aca6 /doc/gawktexi.in | |
parent | 3cb8fca4531cb348984bfc5ff499fbd1e1036f69 (diff) | |
download | egawk-681a5d8b52b7c5725c54bdab507c3c63effad142.tar.gz egawk-681a5d8b52b7c5725c54bdab507c3c63effad142.tar.bz2 egawk-681a5d8b52b7c5725c54bdab507c3c63effad142.zip |
Add PROCINFO["argv"] array to contain the command-line arguments.
Diffstat (limited to 'doc/gawktexi.in')
-rw-r--r-- | doc/gawktexi.in | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/gawktexi.in b/doc/gawktexi.in index da7eeef1..2610a74b 100644 --- a/doc/gawktexi.in +++ b/doc/gawktexi.in @@ -4818,6 +4818,25 @@ function names added by @command{gawk} after the code was written. Standard @command{awk} built-in functions, such as @code{sin()} or @code{substr()} are @emph{not} shadowed in this way. +The @code{PROCINFO["argv"]} array contains all of the command-line arguments +(after glob expansion and redirection processing on platforms where that must +be done manually by the program) with subscripts ranging from 0 through +@code{argc} @minus{} 1. For example, @code{PROCINFO["argv"][0]} will contain +the name by which @command{gawk} was invoked. Here is an example of how this +feature may be used: + +@example +awk ' +BEGIN @{ + for (i = 0; i < length(PROCINFO["argv"]); i++) + print i, PROCINFO["argv"][i] +@}' +@end example + +Please note that this differs from the standard @code{ARGV} array which does +not include command-line arguments that have already been processed by +@command{gawk} (@pxref{ARGC and ARGV}). + @end ignore @node Invoking Summary |