March 2018
Beginner to intermediate
416 pages
9h 24m
English
The environment variable is an associative array containing the values of environment variables for the current process. The index of the array stores the environment variable name, and the elements are the values of particular environment variables. It is also helpful when we want to access the shell environment variable in our AWK script.
For example, the array element ENVIRON["HOME"] will contain the value of the HOME environment variable, ENVIRON["PATH"] will contain the value of the PATH environment variable, and so on. In the following example, we print all the available environment variables and their values:
$ vi environ.awkBEGIN { OFS="=" for( v in ENVIRON ) print v, ENVIRON[v]; }$ awk -f envion.awk
The output ...
Read now
Unlock full access