I'm trying to write a script that adds some path to LD_CONFIG_PATH in order to not get "
blabla.so not found". The problem is that my script is able to modify its own context (via export) but it doesn't affect other shells. I want to set the a variable globally so it persists between reboots and shells.
My current script looks like:
LDPATH='/opt/mqm/lib64' LD_LIBRARY_PATH="$LDPATH:$LD_LIBRARY_PATH" ldconfig
which I run like
sudo ./set_my_ld_path.sh $LD_LIBRARY_PATH
And it returns nothing (
LD_LIBRARY_PATH is empty).
I also tried
LDPATH='/opt/mqm/lib64' env LD_LIBRARY_PATH="$LDPATH:$LD_LIBRARY_PATH" ldconfig
but it only writes all my existing variables such as PATH/LANG/HOME/LC_TIME/...
For example, I can run following script in powershell and it does what I'd like to have here:
# setting an environment variable for current and descendant processes, same as bash `export` $env:OPENCV_DIR = $OPENCV_DIR # applying it machine-wide, persists between users/shells/reboots [Environment]::SetEnvironmentVariable("OPENCV_DIR", $env:OPENCV_DIR, [EnvironmentVariableTarget]::Machine)
How could it be done?