Echo

Guy Harris guy at auspex.UUCP
Sun Dec 11 08:30:40 AEST 1988


>What a botch this is!  Nobody I know of puts /usr/ucb before /usr/bin
>even on native BSD systems.

They don't have to; the default PATH on BSD systems is
":/usr/ucb:/bin:/usr/bin".

>I wouldn't risk that in shell scripts, either, so in effect they have
>added a mechanism that will be of no practical use.

Shell scripts generally want to set PATH right after they've set IFS
(unless your shell doesn't import IFS); I generally do so in my scripts
these days.  If you're in an environment - such as, say, the BRL System
V emulation, which you may be familiar with :-) - where "/usr/bin"
and/or "/bin" may contain a BSD-style version of a command, and
"/usr/5bin" may contain an S5-style version, your script should set the
path appropriately for the version it expects.  I don't know whether
BSD-style versions of commands such as "tr" will be supplied in
"/usr/ucb" in S5R4.0, or if this'll be left up to licensees to do, but
at least on systems that do that (as I suspect the S5R4-based SunOS
will), the rules will be "put '/usr/ucb' at the front if you expect
BSD-style versions, and put it at the end or leave it out if you don't.

"echo" is treated just like non-built-in commands in that sense (thanks
and a tip of the Hatlo hat to Dave Korn for the idea); if the shell
would have found the BSD-style version were it not built in, it makes it
act like the BSD-style version, and if it would have found the S5-style
version were it not built in, it makes it act like the S5-style version.

The mechanism *is* of practical use if you want a script written for a
particular environment (V7/BSD or S5) to run properly when run from both
environments - just set PATH.

>And, there is STILL no way to disable \-escape mapping
>in the System V environment.

The mechanism isn't of practical use for that purpose, but it wasn't
meant to be.  That problem needs to be addressed independently of the
problem of making already-written shell scripts work.



More information about the Comp.unix.wizards mailing list