Use shellescape at the right locations

Shellescape should only be used when variables/strings are used
in the shell directly.  See #9.
Add check for required executables