nimcr icon indicating copy to clipboard operation
nimcr copied to clipboard

Bash-special characters in program arguments are not escaped

Open Nindaleth opened this issue 6 years ago • 1 comments

Hi, thanks for making this. Nimcr is something that I use in probably all of my Nim sources.

I'm writing a tool to parse and sort some text data and it's similar to CSV, only it's separated by | pipes (and sometimes other characters), so I've made the column separator a parameter.

Giving the pipe symbol to the script doesn't really work, though, although it's quoted:

# running via nimcr, pipe unescaped - this may be a bug in how nimcr handles the params
$ ./sort.nim -d '|' -f 9 --mergeOutputs
sh: -f: command not found
SIGPIPE: Pipe closed.

# running via nimcr, pipe escaped - works at the moment
$ ./sort.nim -d '\|' -f 9 --mergeOutputs 
[OK]

# running the resulting binary, pipe unescaped
$ ./.sort -d '|' -f 9 --mergeOutputs
[OK]

Nindaleth avatar Apr 23 '19 14:04 Nindaleth

Interesting, unfortunately this might be hard to fix.. Shebangs are really quite brittle, so I suspect this is yet another issue with those.

PMunch avatar Apr 24 '19 09:04 PMunch