Echo

Erik Murrey erik at mpx2.UUCP
Mon Dec 12 08:33:17 AEST 1988


In article <2258 at xyzzy.UUCP> meissner at xyzzy.UUCP (Michael Meissner) writes:
> [ ... ]
>like I do (in /bin/sh notation):
>
>	if [ -x /bin/sun3 ] && /bin/sun3; then
>		SYSVECHO=/usr/5bin/echo
>	else
>		SYSVECHO=echo
>	fi
>
>	# ...
>
>	${SYSVECHO} ...

While this does work, it is *very* ugly.  Try plowing through big
shell scripts that use ${NAME-OF-PROGRAM-TO-RUN}'s all over the place.
They may be more secure, but at the cost of maintainability.  Setting
the PATH & IFS at the top of each shell script fixes most security holes.

Personally, I like the echo that I have here (and a similar one was
posted to comp.sources.misc) that can understand both the BSD flags,
and the Sys-V escapes.

Maybe SysV.4 should have a "raw" echo for those times when you just
want the actual arguments, un-retouched, sent to stdout.

-- 
Erik Murrey                            /|   //  /~~~~/  |  /
MPX Data Systems, Inc.                / | / /  /____/   |/
erik at mpx2.UUCP                       /  /  /  /        /|  Data Systems, Inc. 
{spl1,vu-vlsi,bpa}!mpx1!erik        /     /  /       /  |====================



More information about the Comp.unix.wizards mailing list