Backslashed escape sequences

Marc W. Abel me at marcabel.com
Sat Sep 20 02:56:27 UTC 2008


Correct -- I missed the -e in the example.

I'm using \033 in my box, but I personally find the letters easiest to
memorize.  \alert, \backspace, \escape, \newline, \tab, \vertical tab.

I don't want you to be tortured, but it looks like a 2 byte change.  But
yes, someone who does a \e thinking she'll get a literal backslash
(although she explicitly turned escape sequence handling on) will have
the echo command's behavior change.

Thanks!

Marc


On Sat, Sep 20, 2008 at 01:46:49AM +0200, Denys Vlasenko wrote:
> On Friday 19 September 2008 03:02, Marc W. Abel wrote:
> > Gladly.  In a Linux console or xterm, you can
> > 
> > gnu-bash $ echo \\ec
> > 
> >     will clear the screen
> >     That's bash behavior, not coreutils echo behavior.
> 
> You mean "echo -e \\ec"?
> > 
> > busybox $ echo \\ec
> > 
> >     will output "\ec" on the next line
> > 
> > any-shell-on-gnu-coreutils-system $ /bin/echo \\ec
> > 
> >     does what Busybox does
> > 
> > The FSF is not tremendously consistent across equivalent utilities; they
> > own the copyrights to bash's echo and coreutils's echo, yet they behave
> > differently.
> 
> Seems like a discrepancy between bash and coreutils.
> All manpages I can find do not mention \e.
> Let's not torture ourself yet trying to mimic both at once,
> especially that \x1b and \033 work.
> --
> vda



More information about the busybox mailing list