Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 6498 - 'echo' escapes displayed not interpreted
Summary: 'echo' escapes displayed not interpreted
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: sh-utils
Version: 6.1
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Bill Nottingham
QA Contact:
URL:
Whiteboard:
: 6768 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 1999-10-29 13:56 UTC by stevec
Modified: 2014-03-17 02:10 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 1999-11-09 19:51:14 UTC


Attachments (Terms of Use)

Description stevec 1999-10-29 13:56:16 UTC
An install script we write fails in RH6.1, and not in AIX,
Solaris, RH5.0, or Suse.  The reason is that a

/bin/echo "mytext\n" >> /myfile

command is placing \n in the file rather than a newline.
Recall that this is fine on other platforms.  Another
feature is:

$ echo hello\c
helloc
$ exit

rather than:

$ echo hello\c
hello$ exit

The problem exists in /bin/echo whether run from bash or
tcsh, and in bash's builtin but not in tcsh's builtin.

Comment 1 Bill Nottingham 1999-10-29 15:32:59 UTC
According to the echo manpage, you should add
'-e' to display escapes.

What version of echo is on the SuSe version you mention?

Comment 2 Bill Nottingham 1999-11-08 16:02:59 UTC
Hmm.... looking at the Changelog for sh-utils, it looks like
that the default of *not* interpreting backslash characters
is the POSIX thing to do.

Comment 3 Bill Nottingham 1999-11-09 16:27:59 UTC
*** Bug 6768 has been marked as a duplicate of this bug. ***

/bin/echo and echo no longer interpret the newline escape
character embedded in a string. E.G.

TMP="This is some text"
TMP=${TMP}"\nwith a newline in the middle"

/bin/echo ${TMP}

This code work fine in 6.0 and other flavors of unix:

This is some text
with a newline in the middle

but in RH 6.1 this is the output:

This is some text\nwith a newline in the middle

This bug has cost us a lot of time and money! What are you
guys smoking over there?! (sorry)


------- Additional Comments From jcassell@resonate.com  11/08/99 15:16 -------
BTW, I neglected to mention, the bug-like echo behavior is exhibited
in a Bourne shell script - i.e. #!/bin/sh.


Note You need to log in before you can comment on or make changes to this bug.