3 ms·
It might have been worthwhile to include a discussion on how to safely escape the shell strings, in case there is no API that receives a list of arguments. On
by ufo 5y ago
It might have been worthwhile to include a discussion on how to safely escape the shell strings, in case there is no API that receives a list of arguments.
On Unix, it is not very intuitive because you cannot use backslash inside a single quoted string. To quote "o'neil" we have to write
'o'\''neil'
- JadeNB 5y ago> On Unix, it is not very intuitive because you cannot use backslash inside a single quoted string. To quote "o'neil" we have to write 'o'\''neil' You can always do the weird one, which I find easier to remember (but is likely so for no one else), of dropping to double quotes for the single quote: 'o'"'"'neil
- TechBro8615 5y agoI’ve used this second one a lot – it really doesn’t pair well with my editor’s auto quoting!
- JadeNB 5y ago(I don't know how I managed to drop the close quote while editing the C&P, but let's call it a sly illustration of the difficulty of proper quoting.)