7

Drush has global option -y (or --yes) which allow you not to type y on every promt during given command execution. (There is also -n or --no option to which following applies as well.)

This works perfectly when you run something like:

drush en i18n -y

The propblem arises, for example, when you trying to run rsync in that manner:

drush rsync @staging:sites/all/themes @production:sites/all/themes -y

Drush just don't get the -y option, and prompts you for a confirmation.

What is this and how to make use of -y option?

  • 1
    I would gladly hear downvoting reasoning, because I run into this [not so obvious] behaviour while scripting some automation, and it was, well, annoying enough. – НЛО Nov 7 '13 at 13:57
17

The solution is to pass all global options like -y or -n before drush command:

drush -y rsync @staging:sites/all/themes @production:sites/all/themes

This allows you to pass options to a shell command run with drush without getting in conflict with drush options:

drush [global options] command [command options]

This will pass [global options] to drush, and [command options] to a shell command.

Take a habit of passing -y and other global options right after you type drush.

Run drush topic docs-strict-options to get a help on that case.

| improve this answer | |
  • This is a subtle difference, yet an important one when invoking commands. Thanks! – tenken Nov 7 '13 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.