On 8/15/2011 9:24 PM, Stephane CHAZELAS wrote:
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
On 17.08.2011 20:53, Stephane CHAZELAS wrote:
2011-08-17, 08:32(+02), Francky Leyn:
On 8/16/2011 10:53 PM, Stephane CHAZELAS wrote:
2) If VAR coincides with an environment variable, and in the
script I change it value, is this then propagated to outside
the script? Is the environment v
2011-08-18, 12:44(+02), Patrick:
[...]
>> $ VAR=foo sh -c 'VAR=bar; env' | grep VAR
>> VAR=foo
>> $ VAR=foo sh -c 'VAR=bar; export VAR; env' | grep VAR
>> VAR=bar
> Interresting! I do not have the bourne shell installed. Bash tries to
> mimic it when called as "sh", but it does not produce the "co
2011-08-18, 04:10(+02), Patrick:
> On 17.08.2011 20:53, Stephane CHAZELAS wrote:
>> 2011-08-17, 08:32(+02), Francky Leyn:
>>> On 8/16/2011 10:53 PM, Stephane CHAZELAS wrote:
>>> 2) If VAR coincides with an environment variable, and in the
>>> script I change it value, is this then propagated t
2011-08-17, 08:32(+02), Francky Leyn:
> On 8/16/2011 10:53 PM, Stephane CHAZELAS wrote:
>> 2011-08-16, 22:24(+02), Francky Leyn:
>> [...]
>>> VAR=FALSE
>>> # some command line procesing, that can set VAR to "TRUE"
>>> if [ $VAR = TRUE ]; then
>>> ...
>>> fi
>>>
>>> Must I effectively write that VAR
2011-08-16, 22:24(+02), Francky Leyn:
[...]
> VAR=FALSE
> # some command line procesing, that can set VAR to "TRUE"
> if [ $VAR = TRUE ]; then
> ...
> fi
>
> Must I effectively write that VAR=FALSE?
> Or will the script work fine without?
Yes, you must write it, because bash may inherit a VAR vari
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 who