Export environment variables through sh file under ubuntu

There are some environment variables that need to be imported, but do not want to import them manually, so you can write a shell script to import, for


example, in export_lib.sh


-Cpp code
1
export LD_LIBRARY_PATH=./lib
If you run ./export_lib.sh directly, you cannot If the import is successful, you need to use the command source export_lib.sh to execute.


After execution, use the command


-Bash code
1
echo $LD_LIBRARY_PATH

you can see the effect


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325723435&siteId=291194637