Quantcast
Channel: How can I set an environment variable only for the duration of the script? - Stack Overflow
Viewing all articles
Browse latest Browse all 5

Answer by hmakholm left over Monica for How can I set an environment variable only for the duration of the script?

$
0
0

WARNING --- READ THE COMMENTS.


Just put

export HOME=/blah/whatever

at the point in the script where you want the change to happen. Since each process has its own set of environment variables, this definition will automatically cease to have any significance when the script terminates (and with it the instance of bash that has a changed environment).


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>