I'd like to set a couple of environment variables on an Ubuntu machine (10.04), but I want to create their value via a script, much like:
export THE_ENV_VAR=$(script_to_execute_and_use_stdout_from)
I've tried setting in /etc/environment
, but that only copies rhs verbatim
I've tried executing a script in /etc/init.d/
at startup, but that does not seem to work.
Ideas?
You need to write your export statement into /etc/bash.bashrc
file, which is a system wide .bashrc
file that will set environments for all system users :)
Edit: One way to do this is to populate a cache file during boot, and let the user scripts read from that cached file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With