Subject: Re: ksh need help!!!
To: David Laight <David.Laight@btinternet.com>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-users
Date: 12/20/2001 18:50:25
    Date:        Thu, 20 Dec 2001 09:38:05 -0000
    From:        "David Laight" <David.Laight@btinternet.com>
    Message-ID:  <00b501c1893a$095a35e0$0100a8c0@snowdrop>

  | However NetBSD is broken, from the SUS
  | (http://www.opengroup.org/onlinepubs/007908799/xcu/echo.html):

echo is a case where being different ("broken") is better.
If the data is modified, it isn't an echo at all - all that \
interpretation nonsense was invented by someone who missed the
existence of a print (or printf) command at shell level, and
decided echo should be forced into that role.

Having echo interpret its args means there's no safe way to
output the value of a variable (or the output from a command
or similar) because any of that might have a \ embedded in it.

Even the -n arg is a problem there - but at least that one is
trivial to avoid, just

	echo -n "${var}${nl}"

where
	nl='
	'

Being compatible with SUS isn't at all important here - everyone
knows there are 2 different echo behaviours, and deals with that
(as best they can).  It has been this way for a very long time now.

And as the SUS says - you should use printf anyway, not echo (they
don't say why, but it is pretty obviously both because there are
two quite different echo commands around, and because the one they
picked to standardise is so obviously brain dead).

kre