4 ms·
Windows command line parsing is crazy. I've recently stumbled onto this post, explaining various pitfalls in parsing command line arguments in windows: http://
by m1el 9y ago
Windows command line parsing is crazy. I've recently stumbled onto this post, explaining various pitfalls in parsing command line arguments in windows:
http://www.windowsinspired.com/how-a-windows-programs-splits-its-command-line-into-individual-arguments/ http://www.windowsinspired.com/how-a-windows-programs-splits...
- zokier 9y agoThat of course depends if you count msvcrt as part of windows or not. I mean the fundamental interface, GetCommandLine, arguably works quite sanely in Windows, the crazy bits come from userland.
- zenojevski 9y agoThe first example "She said "you cant do this", didnt she?" Parses the same way in Bash: $ for A in "She said "you can\'t do this\!", didn't she?"; do echo -$A-; done -She said you- -can't- -do- -this!, didn't she?- So I'd have thought this would be a given. It doesn't look so unintuitive – though I'm not sure if the results are the same for the same reasons. So I went to take a look at the Bash source code. Which is (expectedly) pretty hairy. Top-of-stack quoting characters are referenced through-out, to enable a `pass_next_character` which seems to me similar conceptually to `ignore_special_chars`.