I am getting crazy with simple shell script, I am testing in wsl (ubuntu 2020.4) under win10, the shell script shall be eventually run in a gitlab pipeline.
I want to process a json file in a convert.sh script that I want to call like this: #./convert.sh source.json destination.json
my convert.sh reads jq 'my filter' $1 > $2
if I run in terminal #jq 'my filter' source.json > destination.json
the destination.json is as expected.
but the convert.sh script adds a \m at the end of the filename, I eventually get a destination.json\m file: why is this stuff adding a CR char at the end of the filename ?
I also tried cat $1 | jq 'my filter' | sponge $2 but it generates the same wrong filename.
as said, writing directly the jq cmd in the terminal works flawless.
Any idea?
eventually, I would like to apply 2 filters on my file, and write back to the same filename. it is possible to combine filters?