Re: bug report: tr (textutils v.2.0.21)

[email protected] (Bob Proulx) Sun, 1 Dec 2002 11:47:29 -0700
Newsgroups gmane.comp.gnu.textutils.bugs
Message-ID <[email protected]>
Yakov Lerner (w) <[email protected]> [2002-12-01 13:01:53 +0200]:
> Here is testcase:
>     ... download and build textutils-2.0.21 (*1) ...
> 
>     echo xyzt | ./src/tr 'xyzt' '----'
>     ./src/tr: unrecognized option `----'
>     Try `./src/tr --help' for more information.
> 
>     echo xyzt | ./src/tr 'xy' '--'
>     ./src/tr: two strings must be given when translating
> 
> Apparently this tr mis-accepts SET2 for an option.

Yes.  GNU tr and similar programs accept options anywhere on the
command line.  This is different from POSIX and is therefore affected
by the setting of POSIXLY_CORRECT in the environment.  Here are two
suggested workarounds.

  echo xyzt | tr -- 'xyzt' '----'

  echo xyzt | POSIXLY_CORRECT=1 tr 'xyzt' '----'

Bob