python - Using environment variables in Fabric -
assuming:
export test=/somewhere
i want run command /somewhere/program
using:
with cd('$test'): run('program')
however, doesn't work because $
gets escaped.
is there way use environment variable in fabric cd()
call?
following suggestion @andrewwalker, here more compact solution worked me (and knowledge, result same):
with cd(run("echo $test")): run("program")
but decided go (very slightly) more concise yet readable solution:
run('cd $test && program')
this second solution, if correct, produces same result.
Comments
Post a Comment