[Fix #522] Properly escape shell special characters