Ralf Wildenhues wrote:
> > On a Solaris 10 machine, I happened to not have /usr/xpg4/bin in front of
> > /usr/bin in my PATH. Consequence: The 'tr' program does not recognize
> > the POSIX (and BSD) syntax for character ranges.
> 
> You can work around it by using the System V way of writing ranges:
>   tr '[a-z]' '[A-Z]'
> 
> which will work with both types of tr programs for this range.

True. But I prefer (and recommend) the "follow the standards" policy.
In other words, I find it better to write my code according to the POSIX
standard, and choose tools that follow the POSIX standard, than to
write code in randomly annotated/hacked ways, so that non-POSIX tools
with museum value can be accommodated. For two reasons:
  - Future code maintainers may wonder why I explicitly ask to transform
    '[' into '[' and ']' into ']' and "optimize" this away.
  - Random hacks have a tendency of becoming mutually incompatible. Try to
    put 3 or 5 random hacks in the same place, sometimes there's no way out.

If there was no /usr/xpg4/bin/tr on Solaris, then of course the situation
would be different, then one could only recommend
   tr '[a-z]' '[A-Z]'
or
   tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ

Bruno


Reply via email to