I want to read the new environment variable from my script. I’m trying to export this var through ssh. I’ve tried
test = "qwerty"
cmd = "export my_password=%s;python script.py" % test
execute this command by ssh. In the script:
if os.environ.has_key("my_password"): print "ok"
else: print "failed"
I got “failed” as result. How should i set this env variable?
Just add it before the command without exporting it: