On Wed, Jan 27, 2010 at 2:49 PM, Sharuzzaman Ahmat Raslan <sharuzza...@gmail.com> wrote: > Hi, > > I found the behaviour of the function below is a little bit odd. Appreciate > if someone can share his/her knowledge regarding the behaviour. > > The output of the script will be: > > sharuzza...@debian:~$ ./case1.sh > Nice behaviour, > > Somehow, the backtick for foo() execute the function, echoing the correct > output, but fails to set the variable $gang to the correct value. Because of > that, the function bar() did not echoing anything because the variable $gang > is null.
`` and $() introduce subshells. The parent shell cannot be modified by the subshells.