Subject: Re: discrepency beteen /bin/echo and builtin echo of /bin/sh
To: NetBSD-current Discussion List <current-users@NetBSD.ORG>
From: Greg A. Woods <>
List: current-users
Date: 06/08/2002 18:40:18
[[ hmmm.... shouldn't this be on tech-userlevel? ]]

[ On Saturday, June 8, 2002 at 22:25:54 (+0100), David Laight wrote: ]
> Subject: Re: discrepency beteen /bin/echo and builtin echo of /bin/sh
> Given that the (netbsd) sh builtin has always had -e (look at CVS)
> I don't actually see any reason not to document it, and make /bin/echo
> work the same way.

The only sane behaviour for '-e' is to make it a no-op.....

>  (also 'echo -e -n fred' ought to output fred
> without a newline, not "-n fred").

I suppose....  but what about 'echo -n -e fred'?  seriously.  should it
do the same, (i.e. treat '-e' as a flag, and ignore it)?  is there ever
any reason to consider that someone using 'echo -n' really really really
wants the *BSD behaviour, and _only_ the *BSD behaviour?  I would say no
(i.e. '-e' should alway be a flag and always ignored), but....

> The least painful change would (probably) be to add a ksh style
> print to sh (and csh).

Only until you have to port some scripts that some naive NetBSD user
wrote using non-portable constructs.....

> > > The man page ought to list the builtins, there are some subtle
> > > differences.
> > 
> > It does.
> > 
> >    Builtins
> > 
> >      This section lists the builtin commands which are builtin because they
> >      need to perform some operation that can't be performed by a separate pro-
> >      cess. In addition to these, there are several other commands that may be
> >      builtin for efficiency (e.g.  printf(1), echo(1), test(1), etc).
> That says 'may', printf isn't, echo and test are, don't know about etc.

"type" tells you whether they are or not -- I don't see why the manual
pages should worry about such details since they can differ with every
build....  The documentation need only warn you about the possibility.

								Greg A. Woods

+1 416 218-0098;  <>;  <>;  <>
Planix, Inc. <>; VE3TCP; Secrets of the Weird <>