[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: "echo -e" bug
From: |
Bob Proulx |
Subject: |
Re: "echo -e" bug |
Date: |
Thu, 3 Jul 2008 12:18:21 -0600 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
Micah Cowan wrote:
> Andrew Panin wrote:
> > I can't make echo to show \n and \r symbols. According to 'man echo',
> > there's a way to do this by using '-e' option.
> >
> > However, this doesn't help. Doesn't even matter which option I choose
> > (even 'echo -e \015'), it just shows '015' literally.
>
> More likely, shell interpretation. The shell will turn a bare \015 into
> 015. Try quoting it, such as with '\015' or \\015.
Of course using the octal escapes works. But this is a non-portable
use of echo. I do still use echo often but only for simple strings.
For printing escape sequences the recommended program is 'printf'.
See the "RATIONALE" section here:
http://www.opengroup.org/onlinepubs/009695399/utilities/printf.html
Bob