\r in variables and test

Michael Hoffman b3i4old02@sneakemail.com
Mon Apr 23 01:09:00 GMT 2007

[Samuel Thibault]
>>> In a ./configure script, I call a test program (native python, actually)
>>> that outputs "True\r\n" and I put this result in variable foo. The
>>> problem is that [ "$foo" = True ] doesn't return true because foo
>>> actually contains True\r, not True.

[Michael Hoffman]
>> * [ ${foo/%$'\r'/} = True ]

[Samuel Thibault]
> This looks saner, but shouldn't the test program always do this itself?

Well it's not test (or even the test built-in in bash) that strips out 
\n, but bash when you originally represent the output of the command in 
a variable. I don't know whether it would be a good idea for it to strip 
\r as well.

> Anyhow, the place that needs to be fixed is rather
> /us/share/autoconf-archive/ac_python_devel.m4

I think what needs to be fixed is the expectation that you can mix 
non-Cygwin Python with Cygwin everything else and things will work 
seamlessly. ;)

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

More information about the Cygwin mailing list