Reputation: 33655
How do I write an .sh script what will globally set an environment variable on Ubuntu 14.
i.e.
#!/bin/sh
sets this in to master /etc/environment
export DB_HOST="123"
I am aware I could just run this script and it would set it for the session only!, but what I actually want to do is have the .sh script copy the environment variable to /etc/environment so it is system wide.
OR
is there a way to run the script that it gets set globally?
Upvotes: 2
Views: 1891
Reputation: 27577
Run your script from /etc/profile
, then you'll get what yuo're after.
Upvotes: 1