Builtin command echo does not work properly.
From: [EMAIL PROTECTED] To: bug-bash@gnu.org Subject: Builtin command echo does not work properly. Configuration Information [Automatically generated, do not change]: Machine: i686 OS: cygwin Compiler: gcc Compilation CFLAGS: -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='i686' -DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='i686-pc-cygwin' -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DRECYCLES_PIDS -I. -I/tmp/bash-3.1 -I/tmp/bash-3.1/include -I/tmp/bash-3.1/lib -O2 uname output: Windows_NT d10lt014 1.5.19(0.150/4/2) 2006-01-20 13:28 i686 Cygwin Machine Type: i686-pc-cygwin Bash Version: 3.1 Patch Level: 17 Release Status: release 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. ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: Builtin command echo does not work properly.
> > Description: > The builtin command echo [-neE] [arg ...] does not work properly > > Repeat-By: > Enter: > echo -E "\ttext" > Expected result: > \ttext > Result: > -E text Not a bug. POSIX requires that echo prints everything without regards to options, with escape sequences active. If you are using bash in a manner specified by POSIX, such as invoking it by the name /bin/sh, this is the behavior you should expect. However, there is also the xpg_echo option in shopt which controls this somewhat. For example, I just did: $ echo -E "\ttext" $BASH_VERSION $0 \ttext 3.1.14(4)-release /bin/bash $ shopt xpg_echo xpg_echooff > Fix: > Use /usr/bin/echo to work around this problem. /usr/bin/echo from coreutils is not yet fully POSIX compliant, which is why it will accept options even when bash won't. -- Eric Blake ___ Bug-bash mailing list Bug-bash@gnu.org http://lists.gnu.org/mailman/listinfo/bug-bash
Re: Builtin command echo does not work properly.
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