Environment variables and sudo

Comments
Bookmark and Share

A discovery I made: apparently sudo does not pass through environment variables you set in the shell. So if I’m trying to install git with the GUI, I need to do this:

sudo USE=gtk emerge git

instead of

USE=gtk sudo emerge git

The former starts a root shell and then sets the environment variable USE=gtk, whereas the latter sets the variable and then starts a root shell, but the new shell doesn’t inherit the value of USE.