commit 749e305d3671368a8d08de002f5235298ed1ed53
Cristian Ionescu-Idbohrn
cristian.ionescu-idbohrn at axis.com
Wed Nov 24 21:30:29 UTC 2010
+ # 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. 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.
And you don't really want to do it like in (2), do you?
Cheers,
--
Cristian
More information about the busybox
mailing list