deprecation of echo

Rusch, Daniel Daniel.Rusch at GlobalCrossing.com
Fri Aug 23 15:22:48 CEST 2002


echo "hostaddress\tservice name\treturn code\tplugin output\n"

and 

echo -e "hostaddress\tservice name\treturn code\tplugin output\n"

are two different things

the -e interprets the backslashed escape character '\t'  without it echo
won't interpret it as a tab.  At tleast it didn't for me on RH 7.3

DR

-----Original Message-----
From: Kenneth.ray [mailto:kenneth.ray at travelersla.com]
Sent: Friday, August 23, 2002 7:52 AM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] deprication of echo


This has been bugging me for quite sometime can someone please explain
it like im a 3-year old..
I agree echo -e is not portable but why use the e switch  in the first
place. if you surround the message in qoutes, echo works nicely, I
tested it on AIX redhat, and Solaris. Can anyone show me a instance
where  the output would not work? I have a couple  of custom scripts and
I use echo extensively throughout my configs and within my homegrown
scripts.  This just bugs me to no end becuase Echo was designed to be
just like a parrot, what you see is what you get.  it even works in NT
(though with NT the qoutes are displayed. IE:echo "this is a message"
comes out as "this is a message")

also if your using the -e switch, dont, -e is not available in all forms
of echo, enclose it in qoutes and like me, it should work fine..
feel free to educate this misguided individual(me) into the advantages
of using printf over echo  since it appears that Echo is actually more
portable than printf (printf dont work in NT, not that this matters but
if we are talking portability...)
and since its simple, why not keep it simple.)

just my three cents on the echo versus printf subject..


Message: 10
Subject: Re: [netsaint] Notification message truncated
From: Karl DeBisschop <kdebisschop at alert.infoplease.com>
To: Stanley.G.Martin at mail.sprint.com
Cc: netsaint-users at lists.sourceforge.net
Date: 22 Aug 2002 10:23:53 -0400

On Thu, 2002-08-22 at 10:04, Stanley.G.Martin at mail.sprint.com wrote:
> I found my answer.  Found a README in the source that mentioned using
> 'echo -e' instead of 'printf' and that worked.

It may work, but it is not portable. That's why it was deprecated in the

distribution in favour of printf which is portable.

--
Karl




-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users


-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390




More information about the Users mailing list