[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: initialisation bash variables
From: |
Stephane CHAZELAS |
Subject: |
Re: initialisation bash variables |
Date: |
Wed, 28 Mar 2012 18:25:53 -0000 |
User-agent: |
slrn/pre1.0.0-18 (Linux) |
2011-08-15, 17:15(+02), Francky Leyn:
> Hello,
>
> if you have a variable, say VAR,
> and you don't assign it a value,
> and afterwards you test it,
> what is the value of $VAR then?
>
> random, or an empty string?
[...]
Upon startup, the shell makes one shell variable per environment
variable whose name is compatible with shell variable names.
So for instance, if bash receives "VAR=foo" in its environemt,
$VAR will expand to foo. If it's passed "1=bar", $1 will not be
affected, and it's the same for a few special variables of the
shell.
If passed "A+B=C" or "=D" for instance, that obviously won't be
mapped to shell variables. Some shells do discard variables from
the environment that can't be mapped to shell variables. That's
not the case of bash.
--
Stephane
- initialisation bash variables, Francky Leyn, 2012/03/28
- Re: initialisation bash variables,
Stephane CHAZELAS <=
- Re: initialisation bash variables, Francky Leyn, 2012/03/28
- Re: initialisation bash variables, Stephane CHAZELAS, 2012/03/28
- Re: initialisation bash variables, Francky Leyn, 2012/03/28
- Re: initialisation bash variables, Stephane CHAZELAS, 2012/03/28
- Re: initialisation bash variables, Patrick, 2012/03/28
- Re: initialisation bash variables, Stephane CHAZELAS, 2012/03/28
- Re: initialisation bash variables, Patrick, 2012/03/28
- Re: initialisation bash variables, Stephane CHAZELAS, 2012/03/28
- Re: initialisation bash variables, Patrick, 2012/03/28