From owner-freebsd-hackers Sun Nov 9 10:50:50 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id KAA27636 for hackers-outgoing; Sun, 9 Nov 1997 10:50:50 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by hub.freebsd.org (8.8.7/8.8.7) with SMTP id KAA27624 for ; Sun, 9 Nov 1997 10:50:43 -0800 (PST) (envelope-from j@uriah.heep.sax.de) Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id TAA09501 for freebsd-hackers@freebsd.org; Sun, 9 Nov 1997 19:50:35 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.8.7/8.8.5) id TAA00506; Sun, 9 Nov 1997 19:43:18 +0100 (MET) Message-ID: <19971109194318.GE14919@uriah.heep.sax.de> 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? References: <25358.879002601@axl.iafrica.com> <19971108175832.31362@jraynard.demon.co.uk> <19971109115007.JB56482@uriah.heep.sax.de> <19971109143748.29900@jraynard.demon.co.uk> X-Mailer: Mutt 0.60_p2-3,5,8-9 Mime-Version: 1.0 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <19971109143748.29900@jraynard.demon.co.uk>; from James Raynard on Nov 9, 1997 14:37:48 +0000 Sender: owner-freebsd-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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. ;-)