{ "fileTypes": [ "sh", "ss", "bashrc", "bash_profile", "bash_login", "profile", "bash_logout", ".textmate_init" ], "firstLineMatch": "^#!.*(bash|zsh|sh|tcsh)", "foldingStartMarker": "\\b(if|case)\\b|(\\{|\\b(do)\\b)$", "foldingStopMarker": "^\\s*(\\}|(done|fi|esac)\\b)", "keyEquivalent": "^~S", "name": "Shell Script (Bash)", "patterns": [ { "include": "#comment" }, { "include": "#pipeline" }, { "include": "#list" }, { "include": "#compound-command" }, { "include": "#loop" }, { "include": "#function-definition" }, { "include": "#string" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#heredoc" }, { "include": "#herestring" }, { "include": "#redirection" }, { "include": "#pathname" }, { "include": "#keyword" }, { "include": "#support" } ], "repository": { "case-clause": { "patterns": [ { "begin": "(?=\\S)", "end": ";;", "endCaptures": { "0": { "name": "punctuation.terminator.case-clause.shell" } }, "name": "meta.scope.case-clause.shell", "patterns": [ { "begin": "(\\(|(?=\\S))", "captures": { "0": { "name": "punctuation.definition.case-pattern.shell" } }, "end": "\\)", "name": "meta.scope.case-pattern.shell", "patterns": [ { "match": "\\|", "name": "punctuation.separator.pipe-sign.shell" }, { "include": "#string" }, { "include": "#variable" }, { "include": "#interpolation" }, { "include": "#pathname" } ] }, { "begin": "(?<=\\))", "end": "(?=;;)", "name": "meta.scope.case-clause-body.shell", "patterns": [ { "include": "$self" } ] } ] } ] }, "comment": { "patterns": [ { "captures": { "1": { "name": "punctuation.definition.comment.shell" } }, "match": "(?|&&|\\|\\|", "name": "keyword.operator.logical.shell" }, { "match": "-(nt|ot|ef|eq|ne|l[te]|g[te]|[a-hknoprstuwxzOGLSN])", "name": "keyword.operator.logical.shell" } ] }, "loop": { "patterns": [ { "begin": "\\b(for)\\s+(?=\\({2})", "captures": { "1": { "name": "keyword.control.shell" } }, "end": "\\b(done)\\b", "name": "meta.scope.for-loop.shell", "patterns": [ { "include": "$self" } ] }, { "begin": "\\b(for)\\s+((?:[^\\s\\\\]|\\\\.)+)\\b", "beginCaptures": { "1": { "name": "keyword.control.shell" }, "2": { "name": "variable.other.loop.shell" } }, "end": "\\b(done)\\b", "endCaptures": { "1": { "name": "keyword.control.shell" } }, "name": "meta.scope.for-in-loop.shell", "patterns": [ { "include": "$self" } ] }, { "begin": "\\b(while|until)\\b", "captures": { "1": { "name": "keyword.control.shell" } }, "end": "\\b(done)\\b", "name": "meta.scope.while-loop.shell", "patterns": [ { "include": "$self" } ] }, { "begin": "\\b(select)\\s+((?:[^\\s\\\\]|\\\\.)+)\\b", "beginCaptures": { "1": { "name": "keyword.control.shell" }, "2": { "name": "variable.other.loop.shell" } }, "end": "\\b(done)\\b", "endCaptures": { "1": { "name": "keyword.control.shell" } }, "name": "meta.scope.select-block.shell", "patterns": [ { "include": "$self" } ] }, { "begin": "\\b(case)\\b", "captures": { "1": { "name": "keyword.control.shell" } }, "end": "\\b(esac)\\b", "name": "meta.scope.case-block.shell", "patterns": [ { "begin": "\\b(?:in)\\b", "beginCaptures": { "1": { "name": "keyword.control.shell" } }, "end": "(?=\\b(?:esac)\\b)", "name": "meta.scope.case-body.shell", "patterns": [ { "include": "#comment" }, { "include": "#case-clause" }, { "include": "$self" } ] }, { "include": "$self" } ] }, { "begin": "\\b(if)\\b", "captures": { "1": { "name": "keyword.control.shell" } }, "end": "\\b(fi)\\b", "name": "meta.scope.if-block.shell", "patterns": [ { "include": "$self" } ] } ] }, "math": { "patterns": [ { "include": "#variable" }, { "match": "\\+{1,2}|-{1,2}|!|~|\\*{1,2}|/|%|<[<=]?|>[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=", "name": "keyword.operator.arithmetic.shell" }, { "match": "0[xX]\\h+", "name": "constant.numeric.hex.shell" }, { "match": "0\\d+", "name": "constant.numeric.octal.shell" }, { "match": "\\d{1,2}#[0-9a-zA-Z@_]+", "name": "constant.numeric.other.shell" }, { "match": "\\d+", "name": "constant.numeric.integer.shell" } ] }, "pathname": { "patterns": [ { "match": "(?<=\\s|:|=|^)~", "name": "keyword.operator.tilde.shell" }, { "match": "\\*|\\?", "name": "keyword.operator.glob.shell" }, { "begin": "([?*+@!])(\\()", "beginCaptures": { "1": { "name": "keyword.operator.extglob.shell" }, "2": { "name": "punctuation.definition.extglob.shell" } }, "end": "(\\))", "endCaptures": { "1": { "name": "punctuation.definition.extglob.shell" } }, "name": "meta.structure.extglob.shell", "patterns": [ { "include": "$self" } ] } ] }, "pipeline": { "patterns": [ { "match": "\\b(time)\\b", "name": "keyword.other.shell" }, { "match": "[|!]", "name": "keyword.operator.pipe.shell" } ] }, "redirection": { "patterns": [ { "begin": "[><]\\(", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.interpolated.process-substitution.shell", "patterns": [ { "include": "$self" } ] }, { "comment": "valid: &>word >&word >word [n]>&[n] [n]word [n]>>word [n]<&word (last one is duplicate)", "match": "&>|\\d*>&\\d*|\\d*(>>|>|<)|\\d*<&|\\d*<>", "name": "keyword.operator.redirect.shell" } ] }, "string": { "patterns": [ { "match": "\\\\.", "name": "constant.character.escape.shell" }, { "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.quoted.single.shell" }, { "begin": "\\$?\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "\"", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.quoted.double.shell", "patterns": [ { "match": "\\\\[\\$`\"\\\\\\n]", "name": "constant.character.escape.shell" }, { "include": "#variable" }, { "include": "#interpolation" } ] }, { "begin": "\\$'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.shell" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.shell" } }, "name": "string.quoted.single.dollar.shell", "patterns": [ { "match": "\\\\(a|b|e|f|n|r|t|v|\\\\|')", "name": "constant.character.escape.ansi-c.shell" }, { "match": "\\\\[0-9]{3}", "name": "constant.character.escape.octal.shell" }, { "match": "\\\\x[0-9a-fA-F]{2}", "name": "constant.character.escape.hex.shell" }, { "match": "\\\\c.", "name": "constant.character.escape.control-char.shell" } ] } ] }, "support": { "patterns": [ { "match": "(?<=^|\\s)(?::|\\.)(?=\\s|;|&|$)", "name": "support.function.builtin.shell" }, { "match": "\\b(?:alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|dirs|disown|echo|enable|eval|exec|exit|false|fc|fg|getopts|hash|help|history|jobs|kill|let|local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|times|trap|true|type|ulimit|umask|unalias|unset|wait)\\b", "name": "support.function.builtin.shell" } ] }, "variable": { "patterns": [ { "captures": { "1": { "name": "punctuation.definition.variable.shell" } }, "match": "(\\$)[-*@#?$!0_]", "name": "variable.other.special.shell" }, { "captures": { "1": { "name": "punctuation.definition.variable.shell" } }, "match": "(\\$)[1-9]", "name": "variable.other.positional.shell" }, { "captures": { "1": { "name": "punctuation.definition.variable.shell" } }, "match": "(\\$)[a-zA-Z_][a-zA-Z0-9_]*", "name": "variable.other.normal.shell" }, { "begin": "\\$\\{", "captures": { "0": { "name": "punctuation.definition.variable.shell" } }, "end": "\\}", "name": "variable.other.bracket.shell", "patterns": [ { "match": "!|:[-=?]?|\\*|@|#{1,2}|%{1,2}|/", "name": "keyword.operator.expansion.shell" }, { "captures": { "1": { "name": "punctuation.section.array.shell" }, "3": { "name": "punctuation.section.array.shell" } }, "match": "(\\[)([^\\]]+)(\\])" } ] } ] } }, "scopeName": "source.shell", "uuid": "DDEEA3ED-6B1C-11D9-8B10-000D93589AF6" }