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 Pascal
era eriksson <[EMAIL PROTECTED]> on 22/01/2004 07:10:43 Pour : [EMAIL PROTECTED] (Bob Proulx) cc : [EMAIL PROTECTED] Objet : Re: Printing "-n" with the echo command On Wed, 21 Jan 2004 10:07:35 -0700, [EMAIL PROTECTED] (Bob Proulx) wrote: > [EMAIL PROTECTED] wrote: >> On Wed, 21 Jan 2004 10:39:29 +0100, <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED] 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 < http://news.gmane.org/find-root.php?message_id=%3c200401210934.KAA27028%40Bastion.dcn%3e > > [EMAIL PROTECTED] 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/ >http://www.euro.cauce.org/ cat | more | cat<http://www.iki.fi/era/unix/award.html >http://www.debian.org/ Heavy spam filters in place -- try [EMAIL PROTECTED] if you do not get a timely response from me. Phone +358-44-524-0965 (UTC+2 hours) _______________________________________________ Bug-sh-utils mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-sh-utils
