Web lists-archives.com

Re: Extra CR symbol from backticks on Cygwin 2.9.0

On 9/12/2017 1:38 AM, Nikolay Melekhin wrote:
> Hi Eric,
> Thanks! This option is what I am looking for.
> However I cannot agree with you on bash behavior in Cygwin. Section of
> command substitution in bash documentation says:
> https://www.gnu.org/software/bash/manual/bash.html#Command-Substitution
> "...with any trailing newlines deleted." That is why I expected that

In POSIX and newline is simply a LF.  The fact that your input from a
Windows cmd.exe contains CR has no bearing on POSIX.

> bash should remove trailing newlines in command substitution results,
> which are CRLF on Windows.

If bash were to follow Windows semantics instead of POSIX then your
point would be valid.  However Cygwin is a POSIX emulation so your point
in this case is false.

> From my point of view, bash in Cygwin should follow the same rule on
> Linux and Windows: remove trailing newlines in command substitution.
> So remove trailing CRLF on Windows.

Since Linux and Cygwin are both POSIX then Cygwin is doing what Linux
does.  You just need to adjust the differences by properly filtering
your input.

cyg Simple

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple