Quote:
Originally Posted by
cfajohnson
It is not necessary to quote an assignment unless it contains literal whitespace.
True. You can guarantee that "$1" will never contain a whitespace, then? Quoting variables
out of habit, even in cases where it is not necessarily required, is just staying out of troubles, doing otherwise is asking for them.
Quote:
Originally Posted by
cfajohnson
There's no point to using braces when the name is followed by a character that cannot be contained in a variable name.
Of course there is a point and i named it: precaution. That in this specific case it would not be necessary i did say
explicitly said in the very next sentence, explaining on a counterexample what i meant.
We might disagree philosophically about what constitutes robust programming practices: i believe that many aspects of any often-employed activity (like, for instance, programming for a programmer) is driven by habits as much as conscient effort. My experience is that when i act habitually in a safe way i am generally better off then when i habitually employ a potential hazard - i will probably forget to take the necessary precaution in the one case where it will matter.
To come back from the general to the problem at hand, variable expansion: all i "risk" are two keystrokes and 2 bytes on a disk - compared to the avoided potential problems in cases like the one i cited this is not too much, i suppose.
bakunin