Could I configure drush for non-interacive usage from bash-scripts to be always affirmative as I would pass the --yes and -v-option in /etc/drush/drush.ini? I'm aware that I could set a bash-alias and that I could set it in /etc/drush/drushrc.php. But for reasons of clarity I'd like to use the ini-style-configuration.


Drush will not read options from php.ini / drush.ini by default. Your best option would be to use a bash alias, or set $options['yes'] = TRUE; in a drushrc.php file.

If you really really have to set an option in drush.ini, you could hack this functionality by writing a policy file. It would look something like this:

function policy_init() {
  if (ini_get('drush_yes')) {
    drush_set_option('yes', TRUE);
    // Drush does not expect a globla option to change
    // at this time, so you need to re-call _drush_preflight_global_options().
    // This is not a public API, so the name may change, etc.

The only motivation I can see for doing this is if you already have some fancy mechanism for selecting your php.ini based on context. If you wanted to do that, then put policy.drush.inc in ~/.drush, or some other location where Drush searches for commandfiles.

I have not tested this; post a follow-up comment if you really want to do this and have trouble with it.

| improve this answer | |

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.