Mailinglist Archive: opensuse (3566 mails)
| < Previous | Next > |
Re: [opensuse] bashrc variables
- From: Randall R Schulz <rschulz@xxxxxxxxx>
- Date: Wed, 25 Apr 2007 07:07:45 -0700
- Message-id: <200704250707.45573.rschulz@xxxxxxxxx>
On Wednesday 25 April 2007 00:03, Vince Oliver wrote:
> Hi All,
>
> I can not find any documentation on what is the difference when I
> define some variable in .bashrc file like for example:
>
> COS_PATH=+$COSSPEC2D_DIR/pro:$COS_PATH
>
> and
>
> COS_PATH=$COSSPEC2D_DIR/pro:$COS_PATH
>
> (ie without +). Could somebody tell me?
The plus is not special. If present, it becomes part of the variable's
value.
> Also I am not sure when to export variables. Should I export it at
> the end of .bashrc file or whenever the variable is changed? Or
> perhaps once to export wherever in the file and not to warry about
> changes in later?
Exporting is completely independent of setting. All three of these
techniques yield the same result:
# A:
ENV_VAR=value
export ENV_VAR
# B:
export ENV_VAR
ENV_VAR=value
# C:
export ENV_VAR=value
I prefer the third form (C). The first (A) is the most classic. Some
people think it odd to declare a variable exported before it's actually
set (B).
> thank you
> oliver
Randall Schulz
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
> Hi All,
>
> I can not find any documentation on what is the difference when I
> define some variable in .bashrc file like for example:
>
> COS_PATH=+$COSSPEC2D_DIR/pro:$COS_PATH
>
> and
>
> COS_PATH=$COSSPEC2D_DIR/pro:$COS_PATH
>
> (ie without +). Could somebody tell me?
The plus is not special. If present, it becomes part of the variable's
value.
> Also I am not sure when to export variables. Should I export it at
> the end of .bashrc file or whenever the variable is changed? Or
> perhaps once to export wherever in the file and not to warry about
> changes in later?
Exporting is completely independent of setting. All three of these
techniques yield the same result:
# A:
ENV_VAR=value
export ENV_VAR
# B:
export ENV_VAR
ENV_VAR=value
# C:
export ENV_VAR=value
I prefer the third form (C). The first (A) is the most classic. Some
people think it odd to declare a variable exported before it's actually
set (B).
> thank you
> oliver
Randall Schulz
--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx
| < Previous | Next > |