Implement shell escaping

* Fix security problem raisable by bad custom message
* test the escaping by directly executing the result in the shell.