diff --git a/mode/shell/shell.js b/mode/shell/shell.js
index 570b4e2419bdb2147dc4b0cd9ac8e8c7aa65580e..a6363873951de9171f99b26e449caeebe12ea564 100644
--- a/mode/shell/shell.js
+++ b/mode/shell/shell.js
@@ -108,8 +108,8 @@ CodeMirror.defineMode('shell', function() {
     if (state.tokens.length > 1) stream.eat('$');
     var ch = stream.next(), hungry = /\w/;
     if (ch === '{') hungry = /[^}]/;
-    if (ch === '(') {
-      state.tokens[0] = tokenString(')');
+    if (/['"(]/.test(ch)) {
+      state.tokens[0] = tokenString(ch == "(" ? ")" : ch);
       return tokenize(stream, state);
     }
     if (!/\d/.test(ch)) {