Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

GAWK: Documentation of AWKPATH variable

38 views
Skip to first unread message

Kenny McCormack

unread,
Oct 7, 2017, 9:38:36 AM10/7/17
to
In the documentation, we find this sentence:

* As mentioned in AWKPATH Variable, the current directory is always searched
* first for source files, before searching in AWKPATH; this also applies to
* files named with @include.

This is untrue. It only works if you have "." explicitly in your AWKPATH.

This is Unix we're talking about here - AFAIK, there are no PATH-type
variables in Unix-land that have the DOS/Windows characteristic of
searching the current directory first before using the PATH-type variable.

For example:

$ export AWKPATH=$HOME/awksrc
$ ls shuffle.awk
shuffle.awk
$ gawk -f shuffle.awk
gawk4: fatal: can't open source file `shuffle.awk' for reading (No such file or directory)
$

This applies to all the other variations of the AWKPATH theme as well.
Note that if we unset AWKPATH, then things work as expected, because we
pick up a default value for that variable, that includes ".". But if we
explicitly set it to something that doesn't include ".", then the current
directory will not be searched.

--
Just for a change of pace, this sig is *not* an obscure reference to
comp.lang.c...

Andrew Schorr

unread,
Oct 7, 2017, 12:52:06 PM10/7/17
to
On Saturday, October 7, 2017 at 9:38:36 AM UTC-4, Kenny McCormack wrote:
> In the documentation, we find this sentence:
>
> * As mentioned in AWKPATH Variable, the current directory is always searched
> * first for source files, before searching in AWKPATH; this also applies to
> * files named with @include.

Thanks for catching this. Please note that this seems to be an obsolete comment in the "Include Files" section of the documentation. It links to the main documentation for the AWKPATH variable, which says:

NOTE: To include the current directory in the path, either place
`.' as an entry in the path or write a null entry in the path.

Different past versions of `gawk' would also look explicitly in
the current directory, either before or after the path search. As
of version 4.1.2, this no longer happens; if you wish to look in
the current directory, you must include `.' either as a separate
entry or as a null entry in the search path.

So it appears that there was a failure to update this issue throughout the documentation.

Thanks,
Andy
0 new messages