Echo

Steve Harris vsh at etnibsd.UUCP
Fri Dec 2 08:02:55 AEST 1988


In article <6557 at june.cs.washington.edu> ka at june.cs.washington.edu (Kenneth Almquist) writes:
>I've been implementing a public domain shell and I'm wondering what to
>do about the echo builtin.  The System V echo command interprets a number
>of escape sequences (e.g. \n for newline) which the BSD echo does not,

FYI -- SunOS 3.x has done this brain damaged thing of looking to see
which is first in your PATH variable: /usr/ucb or /usr/5bin.  The
builtin echo (and, I believe, /bin/echo) will operate in either BSD or
ATT mode depending on which directory comes first.

The problem is, what if I want /usr/ucb before /usr/5bin in my PATH,
but also want my echo to recoginze sysV escapes?  I have to do, e.g.:

OPATH=$PATH
$PATH=/usr/5bin:$PATH
echo "\tthis is a test\n"
PATH=$OPATH

Sun had the right idea, but poor implementation.  Make your echo work
either way, but settible according to the value of some environment
variable (e.g., ECHO=BSD vs. ECHO=ATT).  

As for choice of default, I don't know.  Perhaps there should be a
system-wide defaults file (e.g., /etc/defaults) where things like this
could be specified.  Otherwise, those of us without source are out in
the code (oops, cold :-), and those with source will have to recompile.
-- 
Steve Harris -- Eaton Corp. -- Beverly, MA --  uunet!etnibsd!vsh



More information about the Comp.unix.wizards mailing list