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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -