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
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to