[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Réf. : Re: Printing "-n" with the ech o command

From: pascal.maurel
Subject: Réf. : Re: Printing "-n" with the ech o command
Date: Thu, 22 Jan 2004 10:19:01 +0100

I might use printf instead of echo, or something like : echo X-n | sed -e
's/^X// as you suggested.
Thank you for your help

era eriksson <address@hidden> on 22/01/2004 07:10:43

Pour : address@hidden (Bob Proulx)
cc :   address@hidden
Objet :     Re: Printing "-n" with the echo command

On Wed, 21 Jan 2004 10:07:35 -0700, address@hidden (Bob Proulx) wrote:
 > address@hidden wrote:
 >> On Wed, 21 Jan 2004 10:39:29 +0100, <address@hidden> posted to
 >> gmane.comp.gnu.sh-utils.bugs:
 > Hmm...  I see you are using gmane, which is fine.  But on the bug
 > lists there is no assumption that the original poster is subscribed.
 > Many just post the bugs and are not subscribed.  Therefore the
 > convention on the address@hidden lists are to keep the original poster
 > in the To:/Cc: but cut everyone else off.  I don't think the original
 > poster saw your message.

Yeah, I realized after going home. I was going to rectify that today.
Actually I thought of a few more details to point out to him. In
particular, that you could say echo -e '\055n' (if you have echo -e)
and that there's a cute story about the two echos (don't recall if
it's in the New Hackers Dictionary or not ... I'll Google around).

Ah, it's not in Google, it's on page 79 of _The Unix Programming
Environment_, by Kernighan and Pike.

Ah, I'll kill two birds with one stone and Cc: Pascal on this message.

Pascal, the full thread on Gmane is at

 > address@hidden wrote:
 >> The conventional answer to this one is to feed the output to sed or
 >> some such.
 >> echo X-n | sed -e 's/^X//'
 > Conventional?  Bah!  Use printf instead.
 >   printf "-n\n"

I thought of that, and I tried it here, and it doesn't work under all
circumstances. The bash builtin printf says illegal option. And
/usr/bin/printf is in /usr/bin rather than /bin which makes it
unsuitable for situations where /usr might not be mounted (startup
scripts etc).

 > Otherwise most scripts will test and use -e or not as required.  This
 > is one of the things that annoy me about most Linux distros.  They
 > ignore POSIX and require the -e option.

It's not just about Linux and POSIX. It goes way back to a difference
between System V and 7th edition.

/* era */

formail -s procmail <http://www.iki.fi/era/spam/
cat | more | cat<http://www.iki.fi/era/unix/award.html
Heavy spam filters in place -- try address@hidden if
 you do not get a timely response from me. Phone +358-44-524-0965 (UTC+2

reply via email to

[Prev in Thread] Current Thread [Next in Thread]