Path: utzoo!utgpu!watmath!clyde!att!rutgers!ucsd!sdcsvax!ucsdhub!esosun!seismo!uunet!etnibsd!vsh From: vsh@etnibsd.UUCP (Steve Harris) Newsgroups: comp.unix.wizards Subject: Re: Echo Message-ID: <960@etnibsd.UUCP> Date: 1 Dec 88 22:02:55 GMT References: <6557@june.cs.washington.edu> Reply-To: vsh@etnibsd.UUCP (Steve Harris) Organization: Eaton Ion Beam Systems Div., Beverly, MA Lines: 28 In article <6557@june.cs.washington.edu> ka@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