zsh-workers
 help / color / mirror / code / Atom feed
* Re: probably a bug in 'tr' command
  2019-03-12  7:06 probably a bug in 'tr' command Андрей Варяница
@ 2019-03-12  5:23 ` dana
  2019-03-12  7:41   ` Андрей Варяница
  0 siblings, 1 reply; 3+ messages in thread
From: dana @ 2019-03-12  5:23 UTC (permalink / raw)
  To: Андрей
	Варяница
  Cc: zsh-workers

On 12 Mar 2019, at 02:06, Андрей Варяница <asvs07@gmail.com> 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* probably a bug in 'tr' command
@ 2019-03-12  7:06 Андрей Варяница
  2019-03-12  5:23 ` dana
  0 siblings, 1 reply; 3+ messages in thread
From: Андрей Варяница @ 2019-03-12  7:06 UTC (permalink / raw)
  To: zsh-workers

When I run the following command in zsh I get empty result.

echo '-' | tr -dc '[0-9]-'

Expected result is single dash as output.

When I run it in bash or sh, then result is single dash as expected.

% zsh --version
OUTPUT> zsh 5.7.1 (x86_64-pc-linux-gnu)

% tr --version
OUTPUT> tr (GNU coreutils) 8.30
OUTPUT> Copyright (C) 2018 Free Software Foundation, Inc.
OUTPUT> License GPLv3+: GNU GPL version 3 or later 
<https://gnu.org/licenses/gpl.html>.
OUTPUT> This is free software: you are free to change and redistribute it.
OUTPUT> There is NO WARRANTY, to the extent permitted by law.
OUTPUT>
OUTPUT> Written by Jim Meyering.

I will also say, that I poorly familiar with manuals of zsh and even tr. 
So maybe this behavior is not a bug.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: probably a bug in 'tr' command
  2019-03-12  5:23 ` dana
@ 2019-03-12  7:41   ` Андрей Варяница
  0 siblings, 0 replies; 3+ messages in thread
From: Андрей Варяница @ 2019-03-12  7:41 UTC (permalink / raw)
  To: dana; +Cc: zsh-workers

On 12.03.2019 09:23, dana wrote:
>  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

Thanks


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-03-12  5:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-12  7:06 probably a bug in 'tr' command Андрей Варяница
2019-03-12  5:23 ` dana
2019-03-12  7:41   ` Андрей Варяница

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).