bug with cat and backticks? (was: bug with built-in ...)

Norton Allen allen@huarp.harvard.edu
Tue Jan 30 03:55:00 GMT 2007


>
>
>According to Norton Allen on 1/28/2007 1:08 PM:
>> I'm wondering if the problem I am seeing is from the same source. I find
>> that 'apachectl stop' no longer works since a recent cygwin update. I
>> can see that the PIDFILE is being written with a \r\n line ending.
>> 'apachectl stop' then reads the file with
>> 
>>    PID=`cat $PIDFILE`
>
>cat is not a bash builtin, so no this is not the same problem.  Are you
>running a script with CRLF line endings on a binary mount?  If so, read
>the announcment, and use d2u on your script.
>http://cygwin.com/ml/cygwin-announce/2007-01/msg00015.html
> <http://cygwin.com/ml/cygwin-announce/2007-01/msg00015.html>
>

No, this is a text mount:

Cygwin> mount
[cut]
d:\Data on /Data type user (textmode)
[cut]
Cygwin> cd /Data
Cygwin> echo hello >test.txt
Cygwin> xxd test.txt
0000000: 6865 6c6c 6f0d 0a                        hello..
Cygwin> foo=`cat test.txt`
Cygwin> echo "'$foo'"
'hello
Cygwin>

Note the trailing quote is missing because of in intervening CR. It 
seems that the discussion of confusion about whether a program should be 
in text mode or binary mode when pipes are involved would still be 
relevant here.

-Norton


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