Date: Wed, 30 Aug 1995 11:01:39 -0700 (MST) From: Terry Lambert <terry@Artisoft.com> To: bde@zeta.org.au (Bruce Evans) Cc: current@freebsd.org, jkh@time.cdrom.com Subject: Re: What do you think of these patches to echo? Message-ID: <199508301801.LAA18783@phaeton.artisoft.com> In-Reply-To: <199508301715.DAA15517@godzilla.zeta.org.au> from "Bruce Evans" at Aug 31, 95 03:15:46 am
next in thread | previous in thread | raw e-mail | index | archive | help
>
> >Subject: What do you think of these patches to echo?
> >...
> >Synopsis:
> > add \c handling to echo (at the end of an arglist, is
> > synonymous with echo -n ...)
>
> :-(.
8-).
I hate shell scripts that use \c or -n coming from the net and having
half of them work on one box and half work on another.
Since \c is an undefined escape otherwise, I see no problem with
allowing it.
On the other hand, all of my scripts intended to be portable will still
use:
#
# define "echon"
#
ECHON=`echo -n`
if test "x$ECHO" = "x-n"
then
ECHON=xechoc
else
ECHON=xechon
fi
xechoc() {
echo "$*\c"
}
xechon() {
echo -n "$*"
}
echon() {
$ECHON "$*"
}
...
echon "what do you want? "
read x
No shell functions allowed?
#
# define "echon"
#
ECHON=`echo -n`
if test "x$ECHO" = "x-n"
then
ECHON="echo"
ENSUF="\c"
else
ECHON="echo -n"
ENSUF=""
fi
$ECHON "what do you want? $ENSUF"
read x
Please, save me from this abomination! Commit the changes!
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?199508301801.LAA18783>
