manpagez: man pages & more
info gawk
Home | html | info | man

File: gawk.info,  Node: AWKLIBPATH Variable,  Next: Other Environment Variables,  Prev: AWKPATH Variable,  Up: Environment Variables

2.5.2 The 'AWKLIBPATH' Environment Variable
-------------------------------------------

The 'AWKLIBPATH' environment variable is similar to the 'AWKPATH'
variable, but it is used to search for loadable extensions (stored as
system shared libraries) specified with the '-l' option rather than for
source files.  If the extension is not found, the path is searched again
after adding the appropriate shared library suffix for the platform.
For example, on GNU/Linux systems, the suffix '.so' is used.  The search
path specified is also used for extensions loaded via the '@load'
keyword (*note Loading Shared Libraries::).

   If 'AWKLIBPATH' does not exist in the environment, or if it has an
empty value, 'gawk' uses a default path; this is typically
'/usr/local/lib/gawk', although it can vary depending upon how 'gawk'
was built.(1)

   *Note Shell Startup Files::, for information on functions that help
to manipulate the 'AWKLIBPATH' variable.

   'gawk' places the value of the search path that it used into
'ENVIRON["AWKLIBPATH"]'.  This provides access to the actual search path
value from within an 'awk' program.

   Although you can change 'ENVIRON["AWKLIBPATH"]' within your 'awk'
program, this has no effect on the running program's behavior.  This
makes sense: the 'AWKLIBPATH' environment variable is used to find any
requested extensions, and they are loaded before the program starts to
run.  Once your program is running, all the extensions have been found,
and 'gawk' no longer needs to use 'AWKLIBPATH'.

   ---------- Footnotes ----------

   (1) Your version of 'gawk' may use a different directory; it will
depend upon how 'gawk' was built and installed.  The actual directory is
the value of '$(pkgextensiondir)' generated when 'gawk' was configured.
(For more detail, see the 'INSTALL' file in the source distribution, and
see *note Quick Installation::.  You probably don't need to worry about
this, though.)

© manpagez.com 2000-2025
Individual documents may contain additional copyright information.