Escape backslashes and fix escaping for dollar signs in command arguments