Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Sep 1998 14:13:21 -0400
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Martin Cracauer <cracauer@cons.org>, chet@po.cwru.edu
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: 'bug' in /bin/sh's builtin 'echo'
Message-ID:  <v04011705b224500ecbf3@[128.113.24.47]>
In-Reply-To: <19980915175755.A6907@cons.org>
References:  <980915154036.AA11163.SM@nike.ins.cwru.edu>; from Chet Ramey on Tue, Sep 15, 1998 at 11:40:36AM -0400 <19980915162741.A7479@cons.org> <980915154036.AA11163.SM@nike.ins.cwru.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
At 5:57 PM +0200 9/15/98, Martin Cracauer wrote:
>In <980915154036.AA11163.SM@nike.ins.cwru.edu>, Chet Ramey wrote:
>> POSIX.2 says very little about `echo'; it recommends using
>> printf(1) instead.  It defines nothing, and allows everything.
>> Specifically, arguments which contain a backslash, or a first
>> argument of `-n', are `implementation defined'.
>
> I was afraid that would be the case. So much for wasting money on
> standard documents :-)
>
> We obviously should unify /bin/sh's echo and /bin/echo. I vote to
> unify on displaying \c verbatim when -e isn't set, for the reasons
> I stated in my previous mail.

I recently picked up a book called "Go Solo 2", about the Single
Unix Specification.  I don't know how interested the FreeBSD
project is in matching that spec, but that spec is very explicit
that 'echo' should not accept any unix-command options (such as
"-n" or even "--").  It is also explicit that 'echo' should
process the embedded characters such as '\c' and '\n' (it has
a list of which other character-combinations have a special
meaning).

It also makes a point of saying "new applications should use
printf instead", probably to avoid issues of previous 'echo'
implementations.

I don't know how interested we are in this single-unix spec,
but so far I like the idea because it is so specific about
what is and is not allowed.  I'm tired of "standards" which
say "Well, this has been implemented twenty different ways
in the past, so we'll just weasel out and say everything
is implementation-specific".  It's a great attitude for
getting everyone to agree to the spec, but it has no value
when it comes to writing a script (or program) that actually
works on all unix's.

You'll note I'm not volunteering to make any changes :-),
but if we were to make a change then I think we should match
some detailed specification like this, instead of taking a
vote and (mostly likely) ending up with a hybrid version
that will be different from all other versions of echo.
We'll probably still end up with soemthing different than
all other versions of echo, but at least we can point to a
specification as our reasoning for that...   :-)

---
Garance Alistair Drosehn           =   gad@eclipse.its.rpi.edu
Senior Systems Programmer          or  drosih@rpi.edu
Rensselaer Polytechnic Institute

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?v04011705b224500ecbf3>