bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Gawk Handles Late-In-Command-Line -v Variable Assignments


From: Neil R. Ormos
Subject: Re: [bug-gawk] Gawk Handles Late-In-Command-Line -v Variable Assignments Differently When -e and -f Are Omitted
Date: Wed, 17 Apr 2019 02:05:53 -0500 (CDT)

address@hidden wrote:
> "Neil R. Ormos" <address@hidden> wrote:

>> In the examples below, only in Example 6, where
>> source code is provided on the command line
>> without -e, and where a variable assignment is
>> provided after the source code, is the result
>> of the variable assignment not available in the
>> BEGIN rule.

> Thanks for the note.

> You missed something. Try

>       gawk 'BEGIN { print "a =", a
>               for (i in ARGV) print i, ARGV[i] }' -v a=99

> And the light should go on. :-)

I don't mean to be obtuse, but why are the '-v'
and 'a=99' arguments placed in ARGV[] only when
the program source is furnished without -f, -e or
--source= ?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]