linuxpathdependenciesenvironment-variablespardiso

How to set an environment variable to point to a location and how to set path of an environment variable in UBUNTU?


I wish to have a particular environment variable VAR1 point to a particular library named lib123.so which is placed in the home directory in a folder named folder1. I have performed this by typing in the command in terminal:

VAR1=/home/folder1/lib123.so

I also wish to have another environment variable VAR2 set to the path of the location of a file named license.lic which lies in the same folder folder1. I have performed this by doing the following in the terminal:

VAR1=/home/folder1

Are both the commands I have given above correct for the intended task? Is there any way in which I can check for myself if it has worked?

I have tried to explain my queries in a self-sufficient manner. However, if the context is important; I am trying to install the dependencies of a tool named PARDISO (page 31, 1st paragraph: https://pardiso-project.org/manual/manual.pdf).


Solution

  • Yes, the above command sets variable when executing together with other commands like so:

    $ VAR1=/home/folder1/lib123.so MY_AWESOME_COMMAND
    

    Or you can use export so that you won't have to include the variable in each command.

    $ export VAR1=/home/folder1/lib123.so
    

    Test it below:

    $ echo $VAR1
    $ /home/folder1/lib123.so