21.07.2015 Views

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

GAWK: Effective AWK Programming

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

184 <strong>G<strong>AWK</strong></strong>: <strong>Effective</strong> <strong>AWK</strong> <strong>Programming</strong>NOTE: If you want files in the current directory to be found, you must includethe current directory in the path, either by including ‘.’ explicitly in the pathor by writing a null entry in the path. (A null entry is indicated by startingor ending the path with a colon or by placing two colons next to each other(‘::’).) If the current directory is not included in the path, then files cannot befound in the current directory. This path search mechanism is identical to theshell’s.Starting with version 3.0, if <strong>AWK</strong>PATH is not defined in the environment, gawk places itsdefault search path into ENVIRON["<strong>AWK</strong>PATH"]. This makes it easy to determine the actualsearch path that gawk will use from within an awk program.While you can change ENVIRON["<strong>AWK</strong>PATH"] within your awk program, this has no effecton the running program’s behavior. This makes sense: the <strong>AWK</strong>PATH environment variableis used to find the program source files. Once your program is running, all the files havebeen found, and gawk no longer needs to use <strong>AWK</strong>PATH.11.5 gawk’s Exit StatusIf the exit statement is used with a value (see Section 6.4.10 [The exit Statement],page 109), then gawk exits with the numeric value given to it.Otherwise, if there were no problems during execution, gawk exits with the value of theC constant EXIT_SUCCESS. This is usually zero.If an error occurs, gawk exits with the value of the C constant EXIT_FAILURE. This isusually one.If gawk exits because of a fatal error, the exit status is 2. On non-POSIX systems, thisvalue may be mapped to EXIT_FAILURE.11.6 Obsolete Options and/or FeaturesThis section describes features and/or command-line options from previous releases of gawkthat are either not available in the current version or that are still supported but deprecated(meaning that they will not be in the next release).For version 3.1 of gawk, there are no deprecated command-line options from the previousversion of gawk. The use of ‘next file’ (two words) for nextfile was deprecated in gawk3.0 but still worked. Starting with version 3.1, the two-word usage is no longer accepted.The process-related special files described in Section 4.7.2 [Special Files for Process-Related Information], page 70, work as described, but are now considered deprecated. gawkprints a warning message every time they are used. (Use PROCINFO instead; see Section 6.5.2[Built-in Variables That Convey Information], page 113.) They will be removed from thenext release of gawk.11.7 Undocumented Options and FeaturesUse the Source, Luke!Obi-WanThis section intentionally left blank.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!