[Top][All Lists]

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

Re: update doc about Solaris 'tr'

From: Bruno Haible
Subject: Re: update doc about Solaris 'tr'
Date: Mon, 17 Aug 2009 23:08:54 +0200
User-agent: KMail/1.9.9

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]'
   tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ


reply via email to

[Prev in Thread] Current Thread [Next in Thread]