Can drush accept piped commands for aliases? Can drush take piping commands for a multisite command using an alias?

I'm trying to setup a simple refresh function from my prod to dev/staging. Any pointers or tips would be welcome. just started learning this stuff.

drush $prodalias sql-dump --gzip &gt;/tmp/$site.sql.gz

gunzip /tmp/$site.sql.gz | drush $devalias sqlc
It should be allowed to use piping in drush aliases as this feature was added recently by improving escaping options for core-exec.

So you have to upgrade your drush to the recent version (7.x).

See: Are pipes allowed in shell aliases?



If you prefer to use script, here is one which I'm usually using:

#!/bin/sh
# pull-db.sh
# Script to pull the database from remote to local environment.
[ -z "$1" ] &amp;&amp; { echo "Usage: $0 @remote (args)"; exit 1; }
SRC="$1"
shift
drush $SRC sql-dump | drush $* sql-cli