How to Retrieve Env Var in Drush Is there a way to retrieve shell variables in Drush? I cannot find anything in Drush API docs. If there is no way, how does one handle environment (dev, staging, testing etc.) configurations? Any help is much appreciated. Thank you.
What do you mean by "in Drush"?

If you are working in a Drush commandfile (e.g. writing your own Drush command), then you can get environment variables via php using the getenv function.

If you are calling Drush from bash, then you can use bash to expand environment variables (e.g. drush dl --destination=$HOME/.drush)

If you are wondering what to do because you have set up your web server to define environment variables that you are using in settings.php to bootstrap Drupal, then you cannot read these from Drush or bash, because they are only defined by your webserver.  Try defining equivalent variables in your .bashrc.