1 minute read
The HPCC cluster uses bash as the default shell environment. Within this environment, variables can be set and reused.
MYVAR=’Something’ export MYVAR=’Something’ echo $MYVAR
Some softwares utilize this feature and require that specific environment variables be set. For example, every time you login, the following variables are set by default:
echo $HOME #Contains your home path echo $USER #Contains your username echo $PATH #Contains paths of executables echo $LD_LIBRARY_PATH #Contains paths of library dependencies
To see a list of all variables currently set in your shell, use the
You can also
grep through this list to find variables, like so:
env | grep -i home
Or if you are in a
Slurm job, you can find all related
env | grep -i slurm
Try to choose unique names when setting variables. It is best to not overwrite a variable that is already set, unless on purpose.
To set a variable in your current shell, you can do so like this:
Notice that there is no spaces around the
If you would like to set a variable that is carried over to all other commands or sub-shells, then it must be
export MYVAR='Something Important'