| www.delorie.com/archives/browse.cgi | search |
| X-Spam-Check-By: | sourceware.org |
| X-SBRS: | None |
| X-IronPort-AV: | i="4.09,495,1157353200"; d="scan'208"; a="196752681:sNHT17265066" |
| MIME-Version: | 1.0 |
| Subject: | RE: bash CRLF problems (I have read the recent announcement) |
| Date: | Mon, 4 Dec 2006 17:01:35 -0800 |
| Message-ID: | <657A9BE009D3504AAE29BD8E8C2DD61E03104981@SDGEXEVS02.corp.intuit.net> |
| In-Reply-To: | <4574AE59.5080801@cygwin.com> |
| From: | "Wilks, Dan" <Dan_Wilks AT intuit DOT com> |
| To: | <cygwin AT cygwin DOT com> |
| X-IsSubscribed: | yes |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Id: | <cygwin.cygwin.com> |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| X-MIME-Autoconverted: | from quoted-printable to 8bit by delorie.com id kB511lXj003441 |
Kevin Layer wrote:
> I'm really perplexed by the following behavior:
>
> rfr AT mad64 ~
> $ cat -v foo1.sh
> echo 8010 > foo1.out
>
> rfr AT mad64 ~
> $ cat -v foo2.sh
> sh foo1.sh
> version=`cat foo1.out`
> echo ${version}.bar > foo2.out
> cat -v foo2.out
>
> rfr AT mad64 ~
> $ sh foo2.sh
> 8010^M.bar^M
>
> rfr AT 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 AT 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 AT dwilks:~% sh foo2.sh
8010.bar^M
dwilks AT dwilks:~% sh --version
GNU bash, version 3.2.5(7)-release (i686-pc-cygwin)
Copyright (C) 2005 Free Software Foundation, Inc.
dwilks AT 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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |