Take the 2-minute tour ×

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
add comment

3 Answers

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
add comment

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
add comment

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
add comment

Your Answer


