fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] bash variable substitution


From: Vincent Fretin
Subject: Re: [Fab-user] bash variable substitution
Date: Sat, 13 Jun 2009 18:23:08 +0200

On Sat, Jun 13, 2009 at 5:57 PM, Jeff Forcier<address@hidden> wrote:
> Looks like we need to be backslash-escaping dollar signs, then. What's
> going on is that when you call that run() statement, what really
> happens is (and you can see this yourself with --show=debug):
>
>    [localhost] run: /bin/bash -l -c "VAR=\"lol\" ; echo $VAR"
>
> In this case, "$VAR" is interpreted at the top level (the level where
> we are calling /bin/bash) and thus is empty. Backslash-escaping it
> means that it is then only interpreted at the "inner" level, inside
> the call to bash, where it works correctly:
>
>    [localhost] run: /bin/bash -l -c "VAR=\"lol\" ; echo \$VAR"
>    [localhost] out: lol
>
> As this behavior is due to Fabric double-quoting your command as an
> argument to bash, I think it makes sense to add this to the limited
> escaping we do for run and sudo calls (which up till now was simply
> escaping double-quotes). Thus, your original attempt will work as
> expected (and you'll see the added backslash if you do --show=debug).
>
> I've just pushed this change to master as 2dbe070.
>
> Best,
> Jeff

It was a quick fix. :-)
Thanks Jeff, it works great now.

-- 
Vincent Fretin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]