variable-set core

Set a variable.

drush variable-set

  • Aliases

    variable-set has an alias:

    drush vset
  • Arguments

    variable-set accepts 2 arguments:

    name : The name of a variable or the first few letters of its name.
    value : The value to assign to the variable. Use '-' to read the object from STDIN.
  • Options

    variable-set accepts 4 options:

    --yes : Skip confirmation if only one variable name matches.
    --always-set : Older synonym for --exact; deprecated.
    --exact : The exact name of the variable to set has been provided; do not prompt for similarly-named variables.
    --format : Format to parse the object. Use "auto" to detect format from value (default), "string", "integer" or "boolean" for corresponding primitive type, and "json" for JSON.
  • Examples

    Set the preprocess_css variable to true. Skip confirmation if variable already exists.

    drush vset --yes preprocess_css TRUE

    Take the site offline; skips confirmation even if maintenance_mode variable does not exist. Variable is rewritten to site_offline for Drupal 6.

    drush vset --exact maintenance_mode 1

    Choose from a list of variables beginning with "pr" to set to (bool)true.

    drush vset pr TRUE

    Set a variable to a complex value (e.g. array)

    php -r "print json_encode(array('drupal', 'simpletest'));"  | drush vset --format=json project_dependency_excluded_dependencies -

comments powered by Disqus