[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [SAGE] Shell programming conundrum



At 12:36 PM 8/2/2002 -0400, Adam S. Moskowitz wrote:

>         : ${foo:=${foo}}        # <== THIS ONE!

Contrary to other opinions (I've read ahead) I think it does have a very 
subtle effect. If foo is set, it remains set to whatever it already was. 
But if foo is unset, it ends up being set but null. This distinction can be 
important; note in fact that the difference between ":-" and ":=" hinges on 
exactly this distinction.

Whether it matters in your script or not, I don't know. Its effect, if any, 
is not shown in your example. Unless... is there a flag that traps on use 
of unset variables, as in CSH? Or maybe the programmer *thought* there was, 
and was trying to avoid it.

regards,
Greg.

Greg Rose                                       INTERNET: ggr@qualcomm.com
Qualcomm Australia          VOICE:  +61-2-9817 4188   FAX: +61-2-9817 5199
Level 3, 230 Victoria Road,                http://people.qualcomm.com/ggr/
Gladesville NSW 2111    232B EC8F 44C6 C853 D68F  E107 E6BF CD2F 1081 A37C