[Top][All Lists]

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

Re: echo and -n versus \c

From: Bauke Jan Douma
Subject: Re: echo and -n versus \c
Date: Wed, 06 Dec 2006 21:01:41 +0100
User-agent: Thunderbird (X11/20061025)

Raymond DeGennaro II wrote on 06-12-06 20:06:

I was just working on a new server supposedly running the latest version of GNU/Linux and encounted a problem with 'echo'.

On every other *nix system I've used, both the built-in echo in 'sh' (I know there's variations and that's why the scripts I'm using use /bin/echo) and /bin/echo work like this:

RayD$ /bin/echo -n "blah"

RayD$ /bin/echo "blah\c"

On this "brand-new" linux box, they behave like this:

:/bin/echo -n "blah"

:/bin/echo "blah\c"

Also, the man pages state that the '-e' option is default:

    Without -E, the following sequences are recognized and interpolated:

Not sure if this is a behavior change, error in the documentation, legitimate bug, or system admin error.

Here's what system info I have:


:/bin/echo --version
echo (GNU coreutils) 5.2.1
Written by FIXME unknown.

I'd say the behaviour is correct and in line with current coreutils
(mine is 6.4); quoting echo(1):

ECHO(1)                          User Commands                         ECHO(1)

       echo - display a line of text

       echo [OPTION]... [STRING]...

       Echo the STRING(s) to standard output.

       -n     do not output the trailing newline

       -e     enable interpretation of backslash escapes

       -E     disable interpretation of backslash escapes (default)  <--

       --help display this help and exit

              output version information and exit

       If -e is in effect, the following sequences are recognized:

       \0NNN  the character whose ASCII code is NNN (octal)

       \\     backslash

       \a     alert (BEL)

       \b     backspace

       \c     suppress trailing newline

       \f     form feed

       \n     new line

       \r     carriage return

       \t     horizontal tab

       \v     vertical tab

       NOTE: your shell may have its own version of echo, which usually super-
       sedes the version described here.  Please refer to your  shell's  docu-
       mentation for details about the options it supports.

       Written by FIXME unknown.


reply via email to

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