This is the mail archive of the
mailing list for the Cygwin project.
Text commands behave differently under xterm...
- From: Pat <pat at pat dot net>
- To: cygwin at cygwin dot com
- Date: Mon, 5 Aug 2002 16:33:32 -0500
- Subject: Text commands behave differently under xterm...
- Reply-to: pat at pat dot net
I've been tearing out my hair trying to figure out why text line endings
are behaving differently under xterm and the plain NT shell..
First the obvious:
echo | od -c
shows that under an xterm I get \r\n, but under the regular NT shell
I get simply \n. It's not even dependant on the terminal type... It's
So I tried to compensate by removing the extraneous CRs... but I find
that a) sed starts inserting more returns and 2) tr breaks when it's used
inside an eval. It's hard to come up with a test case because I can't
construct the string in a guaranteed way... Here's a simple test that requires
you put some NL term lines in a file for it:
# File 'data' contains any NL terminated multiline data
# Now, why are these not the same?
cat file | sed '/foo/d' | tr -d \\015 | tr '\n' ';' | od -c
output=`cat file | sed '/foo/d' | tr -d \\015 | tr '\n' ';'`
echo $output | od -c
You'll see that the first line works as expected, removing the CRs... but in
the second line they are back! It's as if using the evaluation defeated the
Again - all of that only happens when I'm running an xterm... the plain shell
I was so happy I was almost in tears to see the xterms working under cygwin ;)
But now I'm really frustrated...
Author of Learning Java, O'Reilly & Associates and the BeanShell Java
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html