Hi Steffen,
> ?0[steffen@wales nail.git]$ dash -c "printf 'Hello\\\"\n'"
> Hello\"
> ?0[steffen@wales nail.git]$ bash -c "printf 'Hello\\\"\n'"
> Hello"
>
> I should have double quoted LF as \\n
$ python -c '
> import sys
> print([c for c in sys.argv[1]])
> ' "printf 'Hello\\\"\n'"
['p', 'r', 'i', 'n', 't', 'f', ' ', "'", 'H', 'e', 'l', 'l', 'o',
'\\', '"', '\\', 'n', "'"]
$
It's the «\\» before the «\"» causing the problem; it's unspecified.
One ends up with printf seeing «\"» and my printf(1p) says
The interpretation of a <backslash> followed by any other sequence
of characters is unspecified.
Without it, I get consistent results.
$ bash -c "printf 'Hello\"\n'"
Hello"
$ bash -c "printf 'Hello\"\n'" | sha1sum
f8edb41250edb3fea02ea9cb68488b123773b559 -
$ dash -c "printf 'Hello\"\n'" | sha1sum
f8edb41250edb3fea02ea9cb68488b123773b559 -
--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy