Drush is the most useful command prompt tool for Drupal Developer. In previous posts I discussed about installing Drupal using Drush.
Using Drush we can also set the values of the variables and we can also get/see the values of the variables.
The commands variable set, variable-get, and variable-delete allow you to configure, view, and delete Drupal configuration variables stored at the variable table.
Listing of various available variables:
Drush variable-get will display list of all the variables
$ drush variable-get
And list goes on........... but this list is not so long because drupal sets only some of the variables during installation, rest of the variables are set either when module is enabled or feature is installed.
Drush allows you to filter specific variables. You can filter which variables you want to see by giving part of the variable name as an argument to the command.
$ drush variable-get user
Above are the variables which are related to user settings like user role, user picture size, user picture style etc..
Setting new values to variables using variable-set
A wide use of the variable-set command is to turn on and off Drupal's Maintenance mode. This mode is set through a variable and it is very easy to manipulate its value without having to log in as the administrator and set it in the administration interface. Here is how we can turn on maintenance mode in a Drupal site with a command:
$ drush variable-set maintenance_mode 1
Enter a number to choose which variable to set.
 : Cancel
 : maintenance_mode (new variable)
maintenance_mode was set to 1. [success]
Again if you want to turn maintenance mode off then you can set value to 0, this will unset the maintenance mode of Drupal site.
Some more variable-set commands:
Later i will cover some more tutorials regarding variable-set and other exciting drush features like installing module, packaging module install in make file