Path: utzoo!attcan!uunet!ncrlnk!ncrcae!ece-csc!mcnc!rti!xyzzy!meissner From: meissner@xyzzy.UUCP (Usenet Administration) Newsgroups: comp.unix.wizards Subject: Re: Echo Message-ID: <2258@xyzzy.UUCP> Date: 11 Dec 88 01:33:51 GMT References: <6557@june.cs.washington.edu> <960@etnibsd.UUCP> Reply-To: meissner@xyzzy.UUCP (Michael Meissner) Organization: Data General (Languages @ Research Triangle Park, NC.) Lines: 35 In article <960@etnibsd.UUCP> vsh@etnibsd.UUCP (Steve Harris) writes: | 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 While in general, I prefer not to hard code paths, in this case pragmatism wins out. On scripts where you need System V escape semantics (like scripts that send control sequences to the terminal or windowing system), just hard code the path. If the script is only going to be run on Suns, just use /usr/5bin/echo directly, and don't futz around with the PATH. If your script(s) need to be run on multiple systems, you could set an environment variable, like I do (in /bin/sh notation): if [ -x /bin/sun3 ] && /bin/sun3; then SYSVECHO=/usr/5bin/echo else SYSVECHO=echo fi # ... ${SYSVECHO} ... -- Michael Meissner, Data General. Uucp: ...!mcnc!rti!xyzzy!meissner Arpa: meissner@dg-rtp.DG.COM (or) meissner%dg-rtp.DG.COM@relay.cs.net