[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Will @include be called multiple times for duplicated files?
From: |
Manuel Collado |
Subject: |
Re: Will @include be called multiple times for duplicated files? |
Date: |
Sun, 26 Feb 2023 13:17:16 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 |
El 26/02/2023 a las 4:24, Peng Yu escribió:
https://www.gnu.org/software/gawk/manual/html_node/Include-Files.html
Where does it answer my question?
1.- The gawk manual:
https://www.gnu.org/software/gawk/manual/html_node/Options.html
-i source-file
--include source-file
Read an awk source library from source-file. This option is
completely equivalent to using the @include directive inside your
program. It is very similar to the -f option, but there are two
important differences. First, when -i is used, the program source is not
loaded if it has been previously loaded, whereas with -f, gawk always
loads the file. ...
2.- The man page: "man gawk"
OPTIONS
...
-i include-file, --include include-file
Load an awk source library. This searches for the library
using the AWKPATH environment variable. If the initial search
fails, another attempt will be made after appending the .awk
suffix. The file will be loaded only once (i.e., duplicates are
eliminated), ...
...
AWK PROGRAM EXECUTION
...
In addition, lines beginning with @include may be used to include
other source files into your program. This is equivalent to
using the --include option.
Does this answer your question?
On 2/25/23, Manuel Collado <mcollado2011@gmail.com> wrote:
Please read the gawk manual before asking. Hint: @include and --include.
El 25/2/23 a las 2:04, Peng Yu escribió:
Suppose that A.awk includes B.awk, C.awk includes B.awk, D.awk
includes A.awk and C.awk, if I include D.awk in another awk file, how
many times B.awk will be accessed by awk? Is it twice or once?
In other words, does awk know B.awk has been included already and
therefore will not try to include it again?
--
Manuel Collado - http://mcollado.z15.es
--
Manuel Collado - http://mcollado.z15.es