Friday, July 8, 2016

How to pass an inline environment variable to an application in Linux

To pass an inline environment variable to an application in Linux, do as follows:

$ LS_HEAP_SIZE=4g ./some-script.sh
4g
$ echo $LS_HEAP_SIZE

$

`some-script.sh` simply includes `echo` for the environment variable as follows:

echo $LS_HEAP_SIZE

Note that the environment variable is not available in the next prompt.

No comments:

Post a Comment