[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tr portability
From: |
Bruno Haible |
Subject: |
Re: tr portability |
Date: |
Thu, 25 Aug 2022 15:11:02 +0200 |
Simon Josefsson wrote:
> This is unrelated, but alas I've not found a more portable way to trim
> CR than this since some tr do not support \r:
>
> if echo solaris | tr -d '\r' | grep solais > /dev/null; then
> cr='\015'
> else
> cr='\r'
> fi
> # normalize output
> LC_ALL=C tr -d "$cr" < $TMPFILE > x$TMPFILE
We are only talking about /usr/ucb/tr on Solaris 10:
$ echo solaris | /usr/xpg4/bin/tr -d '\r'
solaris
$ echo solaris | /usr/xpg6/bin/tr -d '\r'
solaris
$ echo solaris | /usr/bin/tr -d '\r'
solaris
$ echo solaris | /usr/5bin/tr -d '\r'
solaris
$ echo solaris | /usr/ucb/tr -d '\r'
solais
Since we are already stating in the generic INSTALL file, since 2008:
On Solaris, don't put '/usr/ucb' early in your 'PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in '/usr/bin'. So, if you need '/usr/ucb'
in your 'PATH', put it _after_ '/usr/bin'.
your precautions above are coping with a situation that is unsupported
anyway.
In GNU gettext, many tests use "tr -d '\r'" since 2007 already, and no one
ever has reported a problem with it.
Bruno