Sunday, April 26, 2020

/bin/sh echo \n

Hello,

I was testing some scripting using /bin/sh and I could not find this
behaviour in the documentation :

> $ /bin/sh
> $ echo -n '\n'
>
> $

It seems that ksh even in sh (posix ?) mode does expansion of \n to an
actual newline.

First is there a way to turn off the \n expansion in simple quotes in /bin/sh ?

Second I don't see this feature described neither in man sh nor man
ksh so is it a known behaviour of ksh ?

Thanks a ton,

--
Thomas de Grivel
kmx.io

No comments:

Post a Comment