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: arnold
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 01:41:02 -0600
User-agent: Heirloom mailx 12.5 7/5/10

Hi.

> 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= ?

The way awk has always worked is that the program is the first non-option
argument on the command line (and there are no -f / -e options).
And then everything following the program text is then placed in ARGV.

Essentially, awk stops parsing the command line for its own options once
it finds that the program is specified on the command line.

So in this case, the '-v' and 'a=99' are no different from
/foo/bar and /bar/baz in

        gawk '...' /foo/bar /bar/baz

That is, they're just strings put into ARGV for the awk program's use.

HTH,

Arnold



reply via email to

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