Subject: Re: discrepency beteen /bin/echo and builtin echo of /bin/sh
To: NetBSD-current Discussion List <current-users@netbsd.org>
From: Eric Gillespie <epg@pretzelnet.org>
List: current-users
Date: 06/10/2002 11:56:03
Robert Elz <kre@munnari.OZ.AU> writes:

> But echo is not supposed to be print, it is supposed to be echo.
> 
> With echo interpreting characters anywhere in its args, there
> is no sane way to do
> 	echo $foo
> unless you know what is in foo to start with, in which case there
> isn't a lot of point printing it...

Amen.

> It sounds as if posix is doing something right, though arguments can be
> made for even getting rid of -n and simply having echo echo its args to
> stdout, with no additions, subtractions, ...

And as a matter of fact they have.  I'm surprised no one has brought
up the new unified POSIX/SUSv3, which forbids all options to echo(1):

http://www.opengroup.org/onlinepubs/007904975/utilities/echo.html

| SYNOPSIS
| 
| echo [string ...]
| 
| DESCRIPTION
| 
| The echo utility writes its arguments to standard output, followed
| by a <newline>. If there are no arguments, only the <newline> is
| written.
| 
| OPTIONS
| 
| The echo utility shall not recognize the "--" argument in the manner
| specified by Guideline 10 of the Base Definitions volume of IEEE
| Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines; "--"
| shall be recognized as a string operand.
| 
| Implementations shall not support any options.

--  
Eric Gillespie <*> epg@pretzelnet.org

Conformity is a sin.