blob: 17e6dd9d03a4cd450fa5f51c0a2acd0223a32c61 [file] [log] [blame]
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +00001## Here is an example for Bourne shell scripts.
Benno Schulenbergfe9da942014-05-16 20:21:34 +00002
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +00003syntax "sh" "\.sh$"
Benno Schulenbergbb4edd02015-02-18 20:01:30 +00004header "^#!.*((ba|da|k|pdk)?sh[-0-9_]*|openrc-run|runscript)"
Benno Schulenbergfe9da942014-05-16 20:21:34 +00005magic "(POSIX|Bourne.*) shell script text"
Benno Schulenberg3de2c702015-04-18 11:35:23 +00006linter dash -n
Mike Scalora6a2032f2016-05-25 22:13:50 +02007comment "#"
Benno Schulenbergfe9da942014-05-16 20:21:34 +00008
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +00009icolor brightgreen "^[0-9A-Z_]+\(\)"
Benno Schulenberg5d5e9302014-02-26 21:33:47 +000010color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
11color green "\<(declare|eval|exec|export|let|local)\>"
12color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
David Lawrence Ramsey5e6434c2006-06-01 17:23:28 +000013color green "-[Ldefgruwx]\>"
14color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
Benno Schulenberg5d5e9302014-02-26 21:33:47 +000015color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|echo|env|grep|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|tar|touch|umask|unset)\>"
Benno Schulenbergfe9da942014-05-16 20:21:34 +000016
Benno Schulenberg5d5e9302014-02-26 21:33:47 +000017# Basic variable names (no braces).
18color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"
19# More complicated variable names; handles braces and replacements and arrays.
20color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:space:]]*[[:alnum:]_]+[[:space:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
Benno Schulenbergfe9da942014-05-16 20:21:34 +000021
22# Comments.
David Lawrence Ramsey93682172006-06-08 12:49:57 +000023color cyan "(^|[[:space:]])#.*$"
Benno Schulenbergfe9da942014-05-16 20:21:34 +000024
25# Strings.
Benno Schulenberg5d5e9302014-02-26 21:33:47 +000026color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
Benno Schulenbergfe9da942014-05-16 20:21:34 +000027
28# Trailing whitespace.
David Lawrence Ramseye081fb92007-04-11 22:18:16 +000029color ,green "[[:space:]]+$"