|
Environment variables are a universal mechanism for conveying configuration information to Unix programs. |
|
|
To get a value for a key, use |
print("FOO:", os.getenv("FOO")) print("BAR:", os.getenv("BAR")) |
|
Running the program shows that we pick up the value
for |
$ lua environment-variables.lua FOO: nil BAR: nil |
|
If we set |
$ BAR=2 lua environment-variables.lua FOO: nil BAR: 2 |
Next example: Exec'ing Processes.