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.

link|improve this question
feedback

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:

 #!/bin/sh

 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.

link|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
feedback

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.

#!/bin/bash
FOO=bar
export foo
wine.real $* &
link|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
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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