From owner-freebsd-current Tue Sep 15 10:00:55 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA15571 for freebsd-current-outgoing; Tue, 15 Sep 1998 10:00:55 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from cs.rpi.edu (mumble.cs.rpi.edu [128.213.8.16]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA15538 for ; Tue, 15 Sep 1998 10:00:38 -0700 (PDT) (envelope-from crossd@cs.rpi.edu) Received: from eggbeater.cs.rpi.edu (crossd@eggbeater.cs.rpi.edu [128.213.8.32]) by cs.rpi.edu (8.9.1/8.9.1) with SMTP id MAA04122; Tue, 15 Sep 1998 12:59:17 -0400 (EDT) Date: Tue, 15 Sep 1998 12:59:14 -0400 (EDT) From: "David E. Cross" To: Martin Cracauer cc: chet@po.cwru.edu, freebsd-current@FreeBSD.ORG Subject: Re: 'bug' in /bin/sh's builtin 'echo' In-Reply-To: <19980915175755.A6907@cons.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Tue, 15 Sep 1998, Martin Cracauer wrote: > In <980915154036.AA11163.SM@nike.ins.cwru.edu>, Chet Ramey wrote: > > > Also, what happens if \c isn't at the end of the string? The -n > > > construct seems superiour to me. > > > > Everything after the \c should be ignored. > > > > > Anyway, please file a PR about this. I'll take care of it when my > > > Posix documents arrive, which should be in time for the 3.0 release. > > > > 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. > > Since bash doesn't recognize \c as special without -e either, I think > compatiblity to other platforms is equivalent (bad) for both > solutions. If anything, I would rate Linux compatiblity to be > slightly more important since we run Linux binaries as well. I have tested sh's echo on the following platforms: AIX (4.2) Solaris 2.5 IRIX 6.x All of them have: "echo 'foo\c'" display without a newline. Seeing that our current /bin/echo already does that, I strongly think that we should bring sh's echo in line with the others (and recognize '\c' by default as no-newline). Better yet would be an environment variable, similar to SUNS 'SYSV3' environment variable, or to provide a way to turn off the builtin. (I think there should be a way to disable a given builtin anyway) -- David Cross To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message