commit 749e305d3671368a8d08de002f5235298ed1ed53
Denys Vlasenko
vda.linux at googlemail.com
Thu Nov 25 05:53:26 UTC 2010
On Wednesday 24 November 2010 22:30, Cristian Ionescu-Idbohrn wrote:
> + # need to use printf: different shells have inconsistent
> + # rules re handling of "\n" in their params,
> + # and ${insert} definitely contains "\n"
> + printf "%s\n" "${header}"
>
> Not sure that would work the way you expect it to.
How do you think I expect it to work?
> Consider this example:
>
> ,----
> | #!/bin/dash
> |
> | set -e
> | set -u
> | #set -x
> |
> | insert="foo\n"
> |
> | printf "1. insert='%s'\n" "$insert"
> | printf "2. insert='$insert'\n"
> `----
>
> The output of that on my box is:
>
> 1. insert='foo\n'
> 2. insert='foo
> '
>
> That is, the expected newline after fooin (1), isn't.
Sorry, what it has to do with *my* code? I use printf "%s\n" ...
not printf "blah blah '%s'\n" ...
--
vda
More information about the busybox
mailing list