3 ms·
The easiest way to quote for the shell: * Add ' at the beginning and end * Replace internal ' with '\'' This is because inside '-quoted string only ' itself
by kanox 7y ago
The easiest way to quote for the shell:
* Add ' at the beginning and end
* Replace internal ' with '\''
This is because inside '-quoted string only ' itself has special semantics.
> wrap each argument in 's if it contains anything suspicious.
Such vague advice is wrong in all contexts.
- pizza234 7y agoI wouldn't rely on a manual mean, considering that there is a built-in API: printf '%q' <string_to_quote>