On Tuesday 05 December 2006 8:01 pm, Greg Wallace wrote:
After the script runs, I do an echo MYVAR and it comes up empty. If I simply enter those same statements outside of a script it works fine! Could someone enlighten me as to what the heck is wrong with having that in a script?
Ok, you need to "source" the script if you want all variables inside it within your current shell. Try this (assuming your script is in current directory) source ./yourScript.sh and try now. You'll see that all variables you defined within script are now part of your session. Another shortcut , instead of typing source, try this: . ./yourScript.sh (that's period space & then your script) The probem you are having is that, when you run your script a new shell is created (the one that is going to actually run your script) and then after the script ends, that shell dies and control resumes back to your shell. Check this out: http://mdobson.home.cern.ch/mdobson/onlinesw/unix-scripting.html#sec4sourcee... HTH, Jorge -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org