Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: probably a bug in 'tr' command



On 12 Mar 2019, at 02:06, Андрей Варяница <asvs07@xxxxxxxxx> wrote:
>When I run the following command in zsh I get empty result.
>
>echo '-' | tr -dc '[0-9]-'
>
>Expected result is single dash as output.

From the manual section on the echo built-in:

>Note that for standards compliance a double dash does not terminate option
>processing; instead, it is printed directly. However, a single dash does
>terminate option processing, so the first dash, possibly following options,
>is not printed, but everything following it is printed as an argument. The
>single dash behaviour is different from other shells. For a more portable way
>of printing text, see printf, and for a more controllable way of printing
>text within zsh, see print.

dana



Messages sorted by: Reverse Date, Date, Thread, Author