bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] Is it possible to @include an awk file whose filename is


From: Jannick
Subject: Re: [bug-gawk] Is it possible to @include an awk file whose filename is stored in a variable?
Date: Sat, 10 Nov 2018 12:15:18 +0100

On Fri, 9 Nov 2018 22:46:50 -0600, Peng Yu wrote:
> I can not @include an awk file whose filename is stored in a variable.
> Is it possible? Thanks.

gawk expects after '@include' a string literal with a file name to be imported. 
At this stage of gawk's code processing variable expansion is not possible.

> $ awk -e 'x = "f.awk"; @include x; BEGIN{ f() }' < /dev/null

This works for me with gawk, instead:
 
$ gawk -i ./f.awk 'BEGIN{ f() }'

So, the @include variable could be set on the command line.

Regards,
J.




reply via email to

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