Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to specify environment variables for a given application only? So that environment variables are set automatically when the application starts ('VAR=VALUE myapp' is not what I want).

The actual problem is, I want wine to always start with a specific LC_ALL setting, but don't want to change LC_ALL globally. There're lots of places that could start wine (terminal, gnome file associations, menu shortcuts), and manually setting LC_ALL in all of these seems too tedious.

share|improve this question
up vote 1 down vote accepted

Another possibility is to change your PATH so that, e.g., /usr/local/bin comes first and then create a /usr/local/bin/wine like so:


 export FOO=bar

 /usr/local/bin/wine "$@"

I don't know how these "gnome file associations" and "menu shortcuts" work. If they hardcode the full path rather than relying on $PATH this soln won't work.

share|improve this answer
Thanks for the idea, it didn't come up to me. Will give it a try. – VladV Sep 17 '10 at 20:56
Actually, Ubuntu has /usr/local/bin before /usr/bin by default, just needed to put a script there. Works fine now. – VladV Sep 17 '10 at 21:04

You could do something like this:

Rename the main wine binary from wine to wine.real. Create a script in place of the wine binary that looks something like this.

export foo
wine.real $* &
share|improve this answer
Tried this, but the script gets overwritten with each wine update. So I'm looking for a more elegant solution. – VladV Sep 17 '10 at 20:43

You could also make an alias so you don't need to change something that your software manager manages. E.g., in your ~/.bash_profile

 alias wine='FOO=bar; \wine'

The \ prevents supresses alias expansion to prevent infinite recursion.

Edit: this solution won't work in all the situations you mention.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.