Is it possible to create a shell object and manipulate it without losing it's data after command execution?
from subprocess import *
sh.Popen('/bin/bash', stdout=PIPE)
sh.communicate('source /path/to/file/env.sh')
print os.getenv('ENV_VAR1')
ENV_VAR1
should be available after sourcing /path/to/file/env.sh
but it's not.
This part of code is not working as expected, how can I make it work?
Here is another try which is not working as well
os.system('source env.sh; echo $ENV_VAR1') #Prints out correct value
os.system('echo $ENV_VAR1') #Prints nothing