How to set an Enviroment variable?
Derek Broughton
news at pointerstop.ca
Thu Mar 20 13:13:02 UTC 2008
Francisco Borges wrote:
> Hello,
>
> On Thu, Mar 20, 2008 at 12:10 AM, Derek Broughton <news at pointerstop.ca>
> wrote:
>> Dario Figueira wrote:
>>
>> > the subject says it all, in Windows i know how, My Computer
>> > proprieties -> advanced and it's there
>> > and here? :)
>>
>> export abc=xyz
>
>> To set a variable for a specific program invocation, you can just use:
>>
>> # variable=value program
>>
>> e.g.:
>>
>> # LANG=fr_CA kate
>>
>> To set a variable for a user at login, you can use the export command in
>> the ~/.bashrc file.
>
> From the bash manual:
> =========
> When bash is invoked as an interactive login shell, or as a
> non-interactive shell with
> the --login option, it first reads and executes commands from the
> file /etc/profile,
> if that file exists. After reading that file, it looks for
> ~/.bash_profile,
> ~/.bash_login, and ~/.profile, in that order,
> =========
>
> So as far as I can tell, bash will only read ~/.bashrc when you start
> it "interactive non-login",
Possibly. I always find the different bash scripts confusing, but I _think_
that's wrong. aiui, .bashrc is executed for _every_ shell - interactive or
not, login or not, whereas .profile only executes for login shells (it
doesn't _need_ to be set for non-login shells, as they inherit from a shell
that already has the .profile settings). But I could be wrong...
In any case, you're right that .profile is where environment variables
should really be set - it is, after all, the per-user counterpart
to /etc/profile, which is where I said it should be set if you want all
users to get it...
--
derek
More information about the kubuntu-users
mailing list