I reduce the problem to its lowest terms. Under linux a git command like this:
git log --pretty=format:{"commit":"%H"}
gives me a valid json element, so something like:
{"commit":"20cafdecc9898113ac6215ae70cd7622dc2cae3b"}
under windows I obtain a not-valid json element, because in some way windows seems to remove the double-quotes elements and I obtain:
{commit:20cafdecc9898113ac6215ae70cd7622dc2cae3b}
Do you know why, or how can I fix it making it work under both os? Thank you!
I assume that your shell on Linux is NOT a
bash
shell because mybash
shell on Linux gives me the same output as on Windows - without double-quotes.The doubles-quotes are special characters for most shells - so you have to protect them either by "escaping" or by "quoting".
This works for bash on Linux and bash on Windows. I have not tested it with
cmd
on Windows.