Syntax.register("bash-script", function (a){ a.push(["&&", "|", ";", "{", "}"] , { klass: "operator"} ); a.push({ pattern: /(?:^|\||;|&&)\s*((?:"([^"]|\\")+"|'([^']|\\')+'|\\\n|.|[ \t])+?)(?=$|\||;|&&)/gmi, matches: Syntax.extractMatches({ brush: "bash-statement"} )} ); } ); Syntax.register("bash-statement", function (a){ a.push("break case continue do done elif else eq fi for function ge gt if in le lt ne return then until while".split(" "), { klass: "keyword"} ); a.push("> < = ` -- { } ( ) [ ]".split(" "), { klass: "operator"} ); a.push({ pattern: /\(\((.*?)\)\)/gmi, klass: "expression", allow: ["variable", "string", "operator", "constant"] } ); a.push({ pattern: /`([\s\S]+?)`/gmi, matches: Syntax.extractMatches({ brush: "bash-script", debug: true } )} ); a.push(Syntax.lib.perlStyleComment); a.push({ pattern: /^\s*((?:\S+?=\$?(?:\[[^\]]+\]|\(\(.*?\)\)|"(?:[^"]|\\")+"|'(?:[^']|\\')+'|\S+)\s*)*)((?:(\\ |\S)+)?)/gmi, matches: Syntax.extractMatches({ klass: "env", allow: ["variable", "string", "operator", "constant", "expression"] } , { klass: "function", allow: ["variable", "string"] } )} ); a.push({ pattern: /(\S+?)=/gmi, matches: Syntax.extractMatches({ klass: "variable"} ), only: ["env"] } ); a.push({ pattern: /\$\w+/g, klass: "variable"} ); a.push({ pattern: /\s\-+[\w-]+/g, klass: "option"} ); a.push(Syntax.lib.singleQuotedString); a.push(Syntax.lib.doubleQuotedString); a.push(Syntax.lib.decimalNumber); a.push(Syntax.lib.hexNumber); a.push(Syntax.lib.webLink); } );