This is the mail archive of the
cygwin
mailing list for the Cygwin project.
RE: bash CRLF problems (I have read the recent announcement)
- From: "Wilks, Dan" <Dan_Wilks at intuit dot com>
- To: <cygwin at cygwin dot com>
- Date: Mon, 4 Dec 2006 17:01:35 -0800
- Subject: RE: bash CRLF problems (I have read the recent announcement)
Kevin Layer wrote:
> I'm really perplexed by the following behavior:
>
> rfr@mad64 ~
> $ cat -v foo1.sh
> echo 8010 > foo1.out
>
> rfr@mad64 ~
> $ cat -v foo2.sh
> sh foo1.sh
> version=`cat foo1.out`
> echo ${version}.bar > foo2.out
> cat -v foo2.out
>
> rfr@mad64 ~
> $ sh foo2.sh
> 8010^M.bar^M
>
> rfr@mad64 ~
> $ mount
> C:\cygwin\bin on /usr/bin type system (textmode)
> C:\cygwin\lib on /usr/lib type system (textmode)
> C:\cygwin on / type system (textmode)
> c: on /c type system (textmode)
> z: on /z type system (textmode)
>
> rfr@mad64 ~
> $
>
>
> The (real) scripts involved run on non-Windows platforms, so putting
> in `d2u' isn't an option. I'd rather not resort to `tr' either, since
> I have a large number of places to fix. Large.
>
> The bug, IMO, is the assigment to version of `cat foo1.out` contains a
> ^M. I'm on a text mount, so this is counter to what I thought would
> happen.
I don't know if this helps you or not, but I get slightly different
output, consistent with what I believe you expected. igncr will indeed
eat the \r from the `cat...` (thanks Eric once again). Unfortunately
you're still left with the trailing \r from the last cat.
dwilks@dwilks:~% sh foo2.sh
8010.bar^M
dwilks@dwilks:~% sh --version
GNU bash, version 3.2.5(7)-release (i686-pc-cygwin)
Copyright (C) 2005 Free Software Foundation, Inc.
dwilks@dwilks:~% echo $SHELLOPTS
braceexpand:emacs:hashall:histexpand:history:igncr:interactive-comments:
monitor
But as was recently pointed out on the list, echo -n would suppress the
final \r in your test case.
Dan
--
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/