Re: initialisation bash variables

2012-03-28 Thread Francky Leyn
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

Re: initialisation bash variables

2012-03-28 Thread 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 to outside the script? Is the environment v

Re: initialisation bash variables

2011-10-02 Thread Stephane CHAZELAS
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

Re: initialisation bash variables

2011-10-02 Thread Stephane CHAZELAS
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

Re: initialisation bash variables

2011-10-02 Thread Stephane CHAZELAS
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

Re: initialisation bash variables

2011-10-02 Thread Stephane CHAZELAS
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

Re: initialisation bash variables

2011-10-02 Thread Stephane CHAZELAS
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