Idézem/Quoting Ralph Corderoy <[email protected]>:

Hi Viktor,

>     ['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  -

Using b/dash -c ".." to switch shell is very misleading. Inside
double-quotes escaped characters loose their backslashes!

Well, that's not quite true, as I showed above.

Yes. In single quotes a double quote should not be escaped.



SZÉPE Viktor, üzemeltetés
https://github.com/szepeviktor/debian-server-tools/blob/master/CV.md
--
+36-20-4242498  [email protected]  skype: szepe.viktor
Budapest, III. kerület




Reply via email to