How to pipe the output of a local() to the stdin of a remote run() command in Fabric?
Is there a simple way to pipe output from local commands to remote ones (and vice versa)?

I've always just piped to a file, moved the file over, and then read it...but it seems like there could be an easier way.

For simpler situations, just capturing the output and using string interpolation works:

    ip = local('hostname -i')
    run('Script was run from ip: %s' % ip)


But when the output either needs escaping to be safe on the command line and/or needs to come from stdin it is a bit trickier.

If the output is bash-safe, then something like `run('echo %s | mycmd' % ip)` would do what I'm looking for (which I guess implies that an equivalent question would be "is there a simple way to bash-escape strings?"), but it seems like there should be a "right way" to provide a remote stdin.
How to pipe the output of a local() to the stdin of a remote run() command in Fabric?
===

Is there a simple way to pipe output from local commands to remote ones (and vice versa)?

I've always just piped to a file, moved the file over, and then read it...but it seems like there could be an easier way.

For simpler situations, just capturing the output and using string interpolation works:

    ip = local('hostname -i')
    run('Script was run from ip: %s' % ip)


But when the output either needs escaping to be safe on the command line and/or needs to come from stdin it is a bit trickier.

If the output is bash-safe, then something like `run('echo %s | mycmd' % ip)` would do what I'm looking for (which I guess implies that an equivalent question would be "is there a simple way to bash-escape strings?"), but it seems like there should be a "right way" to provide a remote stdin.