Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Sep 1998 16:27:41 +0200
From:      Martin Cracauer <cracauer@cons.org>
To:        "David E. Cross" <crossd@cs.rpi.edu>, freebsd-current@FreeBSD.ORG
Subject:   Re: 'bug' in /bin/sh's builtin 'echo'
Message-ID:  <19980915162741.A7479@cons.org>
In-Reply-To: <Pine.GSO.3.95.980914230251.22520A-100000@eggbeater.cs.rpi.edu>; from David E. Cross on Mon, Sep 14, 1998 at 11:06:26PM -0400
References:  <Pine.GSO.3.95.980914230251.22520A-100000@eggbeater.cs.rpi.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
In <Pine.GSO.3.95.980914230251.22520A-100000@eggbeater.cs.rpi.edu>, David E. Cross wrote: 
> I have been attempting to do some network installs of SGI IRIX 6.5
> machines off of a -CURRENT machine.  IRIX 6.5 makes heavy use of 'echo
> foo\c'.  By reading the manpage for echo it appears that '\c' is POSIX to
> not print a newline (similar to -n).  In fact /bin/echo 'does the right
> thing' without the '-e' option.  The shell builtin in /bin/sh however
> requires '-e' to parse \c correctly.  For the moment I have inserted the
> '#define eflag 1' into the 'echo.c' builtin.  Should this change make it
> into the tree 'officially'?

<opionion on>
Personally, I don't like any backslash chars to be active without
-e. Imagine you construct a simple shell script in the commandline and
pass it to a shell as standard input. I'd really like the construct
tool - which is usually echo - can be made *completly*
transparent. Otherwise, I'll face quoting hell.

  echo 'echo -n Date is:" " ; date' | sh

Also, what happens if \c isn't at the end of the string? The -n
construct seems superiour to me.
<opinion off>

For the record, bash doesn't support \c without -e, Sun's sh and ksh
do.

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.

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer
BSD User Group Hamburg, Germany     http://www.bsdhh.org/

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?19980915162741.A7479>