[Nottingham] Bash Variables

Martin martin at ml1.co.uk
Mon Aug 4 10:45:05 BST 2008

Mike Haber wrote:
> Hi Martin,
>> What is it that you're trying to do?
> It was really after the event. A script was run that modified a
> variable, and we wondered if bash kept the previous values tucked away
> someplace safe. 
> With the massive amount of features bash has, I thought that it just
> *might* do that.

Mmmm... That sounds like hopeful non-thinking and "spaghetti" programming.

If you're looking for such obscure features and "side-effects", then
there is a suggestion there that the original design or methodology is
flawed. Or that you should be using a different tool/language for the
job in the first place.

>> Can you not just simply pass the previous values as parameters?
>> Or pipe them in?
>> Or even write them to a real file to then be read in?
>> In desperation, you could use an array...
> I think he'll save them somewhere safe.

Rework the structure to the program instead?...

Resorting to using global variables for working results suggests a
"confusion" of function...

Still good for an interesting question! :-)

And an example of the very harsh glare of open source? (But good for a
rapid fix?)

Good luck,

Martin Lomas
martin at ml1.co.uk

More information about the Nottingham mailing list