0

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.

VladV
  • 163
  • 1
  • 6

3 Answers3

1

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.

Mark Wagner
  • 18,019
  • 2
  • 32
  • 47
  • 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
0

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 $* &
Zoredache
  • 130,897
  • 41
  • 276
  • 420
  • 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
0

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.

Mark Wagner
  • 18,019
  • 2
  • 32
  • 47