Leszek Dubiel wrote:
> Dear Maintainer, :)

Note that I am not the maintainer but another long time shell user.

> Create file /tmp/test that contains: 
> 
>               echo 'a\nb'

Use of the echo command with escape sequences is inherently
non-portable behavior.  See the bash FAQ item E5.

  http://tiswww.case.edu/php/chet/bash/FAQ

Also there are endless mailing list discussions on this behavior that
argues both directions.  It is non-portable behavior.  It has always
been different on different operating systems.

Portable scripts should never use escape sequences in echo strings.
Instead they should use printf which is standard and portable.

> Now run this two commands: 
> 
>     sh /tmp/mytest
>     bash /tmp/mytest
> 
> One of these commands prints two lines while other prints one line: 
>
> root@orion:/tmp# cat mytest 
> echo 'a\nb'
> root@orion:/tmp# sh ./mytest 
> a
> b
> root@orion:/tmp# bash ./mytest 
> a\nb
> root@orion:/tmp# 

At the present time that is the current expected behavior.  I see no
bug here.  Except for the bug of using escape sequences with echo.
But that is a bug in any shell script that uses it and not in either
bash or dash.

Bob

Reply via email to