Christoph Jeksa wrote:
> Description:
>         The builtin command echo [-neE] [arg ...] does not work properly
> 
> Repeat-By:
>         Enter:
>         echo -E "\ttext"
>         Expected result:
>         \ttext
>         Result:
>         -E      text
> 
> Fix:
>         Use /usr/bin/echo to work around this problem.

The echo command looks too simple to cause trouble.  But looks can be
deceiving!  The basic problem with echo is that there are two main
forks of it and they are intrinsically incompatible.

When printing anything that might be interpreted as an escape
sequences it is better to use the 'printf' command.

  printf "%s\n" "\ttext"
  \ttext

See this reference:

  http://www.opengroup.org/onlinepubs/009695399/utilities/echo.html

  It is not possible to use echo portably across all POSIX systems
  unless both -n (as the first argument) and escape sequences are
  omitted.

Bob


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to