2006-06-01 21:23:28 +04:00
|
|
|
## Here is an example for Bourne shell scripts.
|
2014-05-17 00:21:34 +04:00
|
|
|
|
2006-06-01 21:23:28 +04:00
|
|
|
syntax "sh" "\.sh$"
|
2015-02-18 23:01:30 +03:00
|
|
|
header "^#!.*((ba|da|k|pdk)?sh[-0-9_]*|openrc-run|runscript)"
|
2017-11-19 13:10:53 +03:00
|
|
|
magic "(POSIX|Bourne-Again) shell script.*text"
|
2015-04-18 14:35:23 +03:00
|
|
|
linter dash -n
|
2016-05-25 23:13:50 +03:00
|
|
|
comment "#"
|
2014-05-17 00:21:34 +04:00
|
|
|
|
2006-06-01 21:23:28 +04:00
|
|
|
icolor brightgreen "^[0-9A-Z_]+\(\)"
|
2014-02-27 01:33:47 +04:00
|
|
|
color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
|
|
|
|
color green "\<(declare|eval|exec|export|let|local)\>"
|
|
|
|
color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
|
2006-06-01 21:23:28 +04:00
|
|
|
color green "-[Ldefgruwx]\>"
|
|
|
|
color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
|
2014-02-27 01:33:47 +04:00
|
|
|
color 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)\>"
|
2014-05-17 00:21:34 +04:00
|
|
|
|
2014-02-27 01:33:47 +04:00
|
|
|
# Basic variable names (no braces).
|
|
|
|
color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"
|
|
|
|
# More complicated variable names; handles braces and replacements and arrays.
|
|
|
|
color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:space:]]*[[:alnum:]_]+[[:space:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
|
2014-05-17 00:21:34 +04:00
|
|
|
|
|
|
|
# Comments.
|
2006-06-08 16:49:57 +04:00
|
|
|
color cyan "(^|[[:space:]])#.*$"
|
2014-05-17 00:21:34 +04:00
|
|
|
|
|
|
|
# Strings.
|
2014-02-27 01:33:47 +04:00
|
|
|
color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
|
2014-05-17 00:21:34 +04:00
|
|
|
|
|
|
|
# Trailing whitespace.
|
2007-04-12 02:18:16 +04:00
|
|
|
color ,green "[[:space:]]+$"
|