
Using global variables in a sh-script
In article <01be28e7$d438c800$90ba6...@STO9806071456.se.pnu.com>, "Cecilia Burman" <no.commercials.please.cecilia.bur...@eu.pnu.com.remove.beginning.and.end> wrote:
Hmm.. sorry, I don't think I'm getting through.
It's just 1 shellscript. No calls of external shell scripts.
I just want to be able to use a certain variable all through the script, just
like a global variable in Pascal.
That is:
- declare it in the beginning of the script,
- Give it a value somewhere in a function
assign()
{
x=1
}
(or in a while/for loop)
- and then use that value when I get back in the "main" section.
Now it seems that if a while loop is started, a subshell" is started, which
leaves no result in my variable-placeholder. (x)
Hoping this makes sense,...
Willem Koster