On Wed, 21 Jan 2004 10:39:29 +0100, <[EMAIL PROTECTED]> posted to
gmane.comp.gnu.sh-utils.bugs:
 > I understand "-n" is an option of the "echo" command, but could it be
 > possible to print it as regular text when placed between quotes ?

Quotes are handled by the shell, and never seen by echo.�Unless you
actually want

  echo '"-n"'

to echo -n instead of "-n" in which case you can submit a new bug
report about how it would be nice if there was a way to actually get
the double quotes included in the output. Catch 22.

The conventional answer to this one is to feed the output to sed or
some such.

  echo X-n | sed -e 's/^X//'

It's not elegant but in this case I'm afraid backwards compatibility
is more important than elegance. If you want to break backwards
compatibility, you might as well supply your own hand-optimized Bison
version of Hello World to output text.

  yes -n | head -1
  echo Xn | tr X -
  perl -le 'print "-n"'
  emacs --batch --no-init-file --no-site-file --eval '(message "-n")'

(The last one is actually surprisingly fast :-)

Hope this helps,

/* 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/



_______________________________________________
Bug-sh-utils mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-sh-utils

Reply via email to