delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/05/22/10:55:28

Date: Tue, 22 May 2001 17:52:08 +0300
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: JT Williams <jeffw AT darwin DOT sfbr DOT org>
Message-Id: <3405-Tue22May2001175207+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.3.emacs20_6 I) and Blat ver 1.8.9
CC: djgpp AT delorie DOT com
In-reply-to: <20010522084113.H24649@kendall.sfbr.org> (message from JT
Williams on Tue, 22 May 2001 08:41:13 -0500)
Subject: Re: redirection in bash
References: <20010522084113 DOT H24649 AT kendall DOT sfbr DOT org>
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Date: Tue, 22 May 2001 08:41:13 -0500
> From: JT Williams <jeffw AT darwin DOT sfbr DOT org>
> 
> % echo foo > bar
> % od -c < bar
> 0000000   f   o   o  \r  \n
> 0000005

So?  Is this a problem?  This is how it's supposed to work: this is
DOS/Windows, not Unix; text files by default have DOS CR-LF EOLs.

> Also (and this is *really* annoying), >> redirection will
> introduce \r\n delimited lines even if the file original
> was pure \n delimited.

Also expected: >> doesn't read the file, so it cannot do anything that
depends on the original file's contents.  It has been like that since
day one.

> Can this be changed?

Not dynamically.  You could force Bash to use Unix EOL format all the
time (this still requires changes to Bash, but these changes are not
very complicated), but I suspect that this will do more trouble than
it solves, since many DOS/Windows programs cannot grok such files
gracefully.

> If the user has bash loaded, then the user probably wants the Unixy
> behavior anyway.

I think you are wrong.  The user wants Unixy _power_, but not Unixy
files.

- Raw text -


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