bug-bash
[Top][All Lists]
Advanced

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

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


From: Jan Schampera
Subject: Re: Error when script uses CRLF line endings w/ if stmt
Date: Fri, 05 Feb 2010 07:04:39 +0100
User-agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090707)

Evan Driscoll schrieb:

>   echo a
>   echo b
> seemed to work with both CRLF and LF endings. However, further
> experimentation confirmed what you probably already know, which is that
> it only appeared to work; in fact what was happening is that the CR
> character was being passed to echo as part of the argument, and it
> didn't affect the output. In fact, if you put a space after the 'a' and
> 'b', echo receives two arguments beyond the command name: the 'a' or 'b'
> as the first and ^M as the second.)

Yes, that's exactly what will happen.

Personally, I have no problem with the \n-only behaviour (which - in
fact - is not Bash specific. Most programs that use text files have
trouble when you change to the other world), but that doesn't matter
since Chet is the maintainer of Bash, not me ;-)

Moreover, POSIX talks about "<newline>" here, which is a \n. Though I
didn't read through all the rationales, I just took a quick look, maybe
it's not limited to \n.


Jan




reply via email to

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