0

I would like to create a python tool for dynamically setting up my environment. I would like to be able to do the following.

$ echo $FOO
$ ./foo.py
$ echo $FOO
bar

If this is possible I would greatly appreciate assistance getting this working.

asked Sep 21, 2017 at 19:30

1 Answer 1

2

It's impossible (because the Python process has its own environment). You can (though it might not be worthwhile) write a script whose output is commands for bash, and then write eval "$(./foo.py)".

answered Sep 21, 2017 at 19:33

2 Comments

Thanks, this is what I thought. Thanks for confirming, I guess it is time for me to learn bash.
If, say, it's always (and only) FOO you want to modify, you can write export FOO=$(./foo.py) and not learn any more bash.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.