Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Nov 1997 19:43:18 +0100
From:      j@uriah.heep.sax.de (J Wunsch)
To:        freebsd-hackers@freebsd.org
Subject:   Re: Why doesn't /bin/echo use getopt?
Message-ID:  <19971109194318.GE14919@uriah.heep.sax.de>
In-Reply-To: <19971109143748.29900@jraynard.demon.co.uk>; from James Raynard on Nov 9, 1997 14:37:48 %2B0000
References:  <25358.879002601@axl.iafrica.com> <19971108175832.31362@jraynard.demon.co.uk> <19971109115007.JB56482@uriah.heep.sax.de> <19971109143748.29900@jraynard.demon.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
As James Raynard wrote:

> It's ugly, but it works, and this is a rare situation anyway.

Well, rare situation or not, the question is if you wanna truly echo
something the user has entered into a shell script variable, it seems
your only option is to always do it this way.  Nobody does, of course,
which means all these scripts are probably vulnerable against input
starting with -n.  SysV is worse, since they were `smart' with their
backslashomania (as opposed to BSD inventing printf(1) for this
purpose).  It seems to be nearly impossible to echo a string verbatim
in SysV if you don't know what the string is.

> [The Unix Programming Environment, Kernighan and Pike]

Oh, that's cheating. :-)

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19971109194318.GE14919>