Web lists-archives.com

Extra CR symbol from backticks on Cygwin 2.9.0




Command line utilities in Windows add CRLF as new line symbol in an output.

For example:

echo "Windows"
TEST=`cmd /c "echo Win"`
echo " ${TEST} " | od -t x1
echo "CYGWIN"
TEST=`echo Win`
echo " ${TEST} " | od -t x1

Output:

Windows
0000000 20 57 69 6e 0d 20 0a
0000007
CYGWIN
0000000 20 57 69 6e 20 0a
0000006

I'd expect that Cygwin must remove CRLF symbols from backtick results,
but remove only LF symbol. It gets different results on Windows and
Linux. Result on Windows has additional CR symbol and for example
string comparision, which is working in Linux, fails in Windows.

Is any kind of an option/setting which removes such CRs or it is a bug
in Cygwin?


Best regards,
Nikolay Melekhin

--
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