Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 10 Nov 1997 07:21:56 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Why doesn't /bin/echo use getopt?
Message-ID:  <199711100721.AAA09666@usr06.primenet.com>
In-Reply-To: <19971109194318.GE14919@uriah.heep.sax.de> from "J Wunsch" at Nov 9, 97 07:43:18 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > 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.

So don't use "echo"...

cat <<EOF
-n
EOF


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



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