Reputation: 21
script file set_env
:
#!/bin/bash
export LD_LIBRARY_PATH=some_path/openssl/lib/
I run it from the terminal: ./set_env
but variable is not established:
printenv | grep "LD_LIBRARY_PATH"
prints nothing.
So it should be?
Upvotes: 0
Views: 73
Reputation: 15246
A child process cannot change the environment of the parent.
The only way to do this is to have the parent environment source the script.
It's all in how your "run" it.
./set_env # won't work creates a child process that evaporates
. ./set_env # reads the script in the *CURRENT* environment, loads the vars
Upvotes: 2