Lars J. Aas writes:
> : -for warning in `IFS=,; echo syntax,$WARNINGS,$warnings | tr [A-Z] [a-z]`
> : +for warning in `IFS=,; echo syntax,$WARNINGS,$warnings | tr '[A-Z]' '[a-z]'`
> Why use the braces at all?  Are they really necessary?  tr A-Z a-z has
> always worked for me, and that format won't be expanded by the shell.

The square brackets were a system-V-ism, SVID era.  I don't
have any manuals from that era any more, but I seem to think
that 'A-Z' without the brackets would be considered just
three chars, not a range.  this was completely different
from BSD Unix behavior, but '[A-Z]' worked on BSD cuz its tr
would treat the '[' as a non-magic character and translate
'[' to '['.  so script writers just used '[A-Z]' all the
time in self-defense.

these days, we have POSIX thingies in tr like '[:alpha:]' so
'[' is magic again, sometimes, depending.
--

Reply via email to