bash 2.0.2 backquoted text includes final carriage return

Earnie Boyd
Mon May 31 21:10:00 GMT 1999

--- Bernard Dautrevaux <> wrote:
> Not sure I can agree :-(; IIRC the sh semantics of command substitution
> is to replace the string `cmd` by the standard output from running
> "cmd", with the last new-line stripped. It's sh problem to understand
> that it is running on Losedows, and that, even if usually the default
> should be to open pipes in binary mode to avoid too much problems, in
> this case the pipe used to retrieve "cmd" output must be opened (on sh
> end at least) in TEXT mode, as we expect it to contain text!...
> So IMNSHO its a genuine bash Losedows-porting bug :-) (and ash also
> AFAIK); being forced to cripple all my scripts by kludges like:
> 	HOST=`hostname | tr '[:space:]' ' '`
> that only works because, I think, tr is willing to work on binary
> streams and thus forces its standard input and output in binary mode :-(
> This work but is both ugly and error prone; the solution should be to
> fix bash and ash (and perhaps also tcsh, pdksh and the like...)
> One must never underestimate the time needed to understand exactly how
> to set up file modes when porting UNIX code to Losedows; and it's not
> always possible to keep the simple 'use the default and let the user
> struggle with it' approach. In a shell script some pipes must use the
> binary mode default, some must use text mode and I'm not sure that
> changing CYGWIN dynamically will do the job for the enclosing shell :-<
> Correct me if I'm wrong,

You have your mounted mode settings set to binary mode processing, is this not
correct?  Suggestion, change them back to text mode processing.  I don't have
any of these problems.  In the default text mode processing, the \r line ending
in scripts and bash/ash isn't a problem.

As I've stated before, operate in the default mode and the programs that aren't
ported properly to handle binary files need to be fixed.  Differences between
platforms have always been a challenge and will forever be.  That not only
includes UNIX vs WIN32 vs MSDOS vs VMS vs etc. but also includes different
flavors of the "same" operating system such as UNIX BSD or UNIX SYSTEM V or ...
"Earnie Boyd" < >
       DLLHELP: < >
                < >
Do You Yahoo!?
Get your free address at

Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list