delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/07/31/13:47:25

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Date: Tue, 31 Jul 2001 18:38:08 +0100
Message-ID: <3366-Tue31Jul2001183808+0100-starksb@ebi.ac.uk>
X-Mailer: 21.1 (patch 12) "Channel Islands" XEmacs Lucid (via feedmail 9-beta-7 I);
VM 6.92 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid
From: David Starks-Browning <starksb AT ebi DOT ac DOT uk>
MIME-Version: 1.0
To: sg AT broesel DOT sv DOT newtron DOT net
Cc: cygwin AT cygwin DOT com
Subject: RE: make, sh, bash and echo
In-Reply-To: <003401c119b5$c0538ac0$21c9ca95@mow.siemens.ru>
References: <200107311059 DOT f6VAxtc27922 AT broesel DOT sv DOT newtron DOT net>
<003401c119b5$c0538ac0$21c9ca95 AT mow DOT siemens DOT ru>

Andrej is correct, but here's a more detailed explanation:

'make' uses /bin/sh to execute commands.  'sh' is really ash, which
has its own 'echo' builtin.  That echo does not have the same options as
/bin/echo.  Bash's echo builtin *does* use the -ne options.  But even
that one is not as full featured as /bin/echo, which is part of the
sh-utils package.  (In the bash shell, type "echo --version" and
"/bin/echo --version".)

Even if PATH is set correctly, the ash shell builtins take precedence.

Use /bin/echo if you want the fancy echo, regardless of shell.
But that's only a "sure thing" in Cygwin.  /bin/echo on other UNIX's
may not be full-featured.

Hope this helps.

Regards,
David
(Cygwin FAQ maintainer)

On Tuesday 31 Jul 01, Borsenkow Andrej writes:
> 
> >
> > Makefile:
> >
> > all:
> > 	echo -ne "foo\nbar" > bar
> >
> > $ make --unix
> > $ cat bar
> > -ne foo\nbar
> >
> > Seems like the wrong echo is executed because SHELL is
> > /bin/sh.exe and PATH isn't set correctly, you know why.
> > On Unix of course the right one and only echo is executed.
> 
> It is inherently non-portable. You cannot expect echo to understand any
> option at all.
> 
> > If I add the line SHELL=/bin/bash.exe it works the way i expect.
> >
> 
> The way you expect is not neccessarily how it works in real life.
> 
> > Is there any better solution ?
> >
> 
> Yes, use portable constructs. Look in Autoconf manual that has good overview
> of common portability problems with assorted tools (including echo).
> 
> 
> -andrej


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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