delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/10/13/16:31:15

X-Spam-Check-By: sourceware.org
Date: Fri, 13 Oct 2006 16:30:58 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: Matthew Woehlke <mwoehlke AT tibco DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: shopt igncr not working
In-Reply-To: <egoqms$b9u$1@sea.gmane.org>
Message-ID: <Pine.GSO.4.63.0610131630110.2659@access1.cims.nyu.edu>
References: <1160655422743 DOT antti DOT nospam DOT 1605718 DOT wGO_WJ9D1NlId3tB-z6Qig AT luukku DOT com> <20061012123406 DOT GA30908 AT trixie DOT casa DOT cgf DOT cx> <452EA386 DOT 9010201 AT qualcomm DOT com> <egmbf1$9v6$1 AT sea DOT gmane DOT org> <452F1F4A DOT 2050705 AT qualcomm DOT com> <egobgc$c0q$1 AT sea DOT gmane DOT org> <egoqms$b9u$1 AT sea DOT gmane DOT org>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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

On Fri, 13 Oct 2006, Matthew Woehlke wrote:

> http://cygwin.com/acronyms/#PPIOSPE, thanks!
>
> Rob Walker wrote:
> > Matthew Woehlke wrote:
> > > Rob Walker wrote:
> > > > Matthew Woehlke wrote:
> > > > > Rob Walker wrote:
> > > > > > Many, many other cross-platform products make allowances for CRLF
> > > > > > (version control systems are a prime example) to maximize
> > > > > > compatibility, and thereby their usefulness, on Windows.  Cygwin's
> > > > > > recent changes (with make and bash) here has put a real crimp in my
> > > > > > plans to depend on cygwin for a portable build environment.
> > > > >
> > > > > I think using 'igncr' should satisfy your complaints. If it doesn't,
> > > > > you need to tell use WHY (which, you'll notice, the OP failed to do).
> > > >
> > > > So far, igncr hasn't worked for me either.  I think this is because I
> > > > don't know how to use it.
> > > >
> > > > This is the simple shell script I'd like to have work (lines separated
> > > > by CRLF):
> > > >
> > > >   #!/bin/bash
> > > >   echo helloworld
> > > >
> > > > [snip]
> > > > I also tried editing the script (which I fear breaks it for non 3.x
> > > > users of bash):
> > > >
> > > >   #!/bin/bash -O igncr
> > > >   echo helloworld
> > >
> > > Did you try adding 'shopt igncr' to the script? This won't (shouldn't, at
> > > least!) break it for non-3.1-9 users (and if you stick a
> > > 2>/dev/null after it, won't print errors).
> >
> > A ha!  This form works in 3.1-9
> >
> >    shopt -s igncr; #
> >    #!/bin/bash
> >    echo hello world
>
> Hmm, that should be the second line, not the first (not sure but I would guess
> the shebang is ignored when it isn't first). Does it still work that way, or
> does bash get confused about the CR on the shebang line? (If the latter, I
> would say this is a real bug that needs to be addressed somehow, or maybe
> igncr should affect the invoking bash's handling of the shebang).
>
> > But it apparently _does_ break for non-3.1-9 users:
> >
> >    rwalker AT sycophant> ./helloworld.sh
> >    shopt: not found
> >    hello world
> >    rwalker AT sycophant> bash --version
> >    GNU bash, version 2.05b.0(1)-release (i686-pc-cygwin)
> >    Copyright (C) 2002 Free Software Foundation, Inc.
>
> It does? It looks like it did what it is supposed to do; gripe, and then
> correctly run the rest of the script. See my earlier suggestion about adding
> '2>/dev/null' after the 'shopt'.

See <http://cygwin.com/ml/cygwin-announce/2006-10/msg00000.html>, the part
that says "if you want your script to be portable"...
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019