[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error when script uses CRLF line endings w/ if stmt

From: Greg Wooledge
Subject: Re: Error when script uses CRLF line endings w/ if stmt
Date: Fri, 5 Feb 2010 08:10:38 -0500
User-agent: Mutt/

On Thu, Feb 04, 2010 at 11:54:51PM -0600, Evan Driscoll wrote:
> Why not make Bash consider \r\n a legitimate line ending? What possible 
> reason could there be for treating carriage return characters as it does 
> now?

Well, the most literal reason is that the shebang (#!/program) line
will not work with a carriage return.  This line is read as a comment
by bash, but as a "use this program" directive by the underlying OS.
The OS is going to try to run $'/program\r' and will not find it.
Unless of course you made $'bash\r' a symlink to bash, and so on.

Apart from that, there's no reason a Cygwin-style shell option couldn't
be used on Unix.  Other than, of course, the fact that it's a grossly
bad habit to let yourself fall into; and the fact that no other shell
would ever be able to read the script; and the 40 years of precedent for
the current behavior....

reply via email to

[Prev in Thread] Current Thread [Next in Thread]