[Top][All Lists]

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

Re: Builtin command echo does not work properly.

From: Bob Proulx
Subject: Re: Builtin command echo does not work properly.
Date: Thu, 20 Apr 2006 00:41:17 -0600
User-agent: Mutt/1.5.9i

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"

See this reference:


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


reply via email to

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