jbn35564@uxa.cso.uiuc.edu (J.B. Nicholson) (04/19/91)
How do I force usage of an already defined var or a var I want to make global in KSH? I've got a function that has a number of local variables all made local with typeset, but there is one variable that may already exist in the calling shell, or may not. Either way, I want this variable, $PATHHIST, to be global. When I access it, it seems to be able to read the existing value of the variable, but not able to modify and have it so the calling shell gets the modified value. To make the above happen, I was using: PATHHIST=${PATHHIST}'value' where "export PATHHIST='before'" was given to the calling shell. Also, the trace of the program seems to show the correct value for $PATHHIST, but when the function exits, I am left with the value of $PATHHIST that I started the function with; totally unmodified. When I use "typeset -x PATHHIST" and then do the line above, a local variable (that I would assume is visible to child shells) seems to be made because the trace of the function shows that $PATHHIST has a value of 'value' and not 'beforevalue'. Thanks. Jeff -- +----------------------------------------------------------------------------+ | "If you hear an onion ring - answer it." J.B. Nicholson | +----------------------------------------------------------------------------+ | jeffo@uiuc.edu (Internet) These opinions are mine, that's all.| +----------------------------------------------------------------------------+