File: sh.nanorc

package info (click to toggle)
nano 8.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 16,832 kB
  • sloc: ansic: 77,597; sh: 4,960; makefile: 219; sed: 16
file content (42 lines) | stat: -rw-r--r-- 1,611 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
## Syntax highlighting for Bourne shell scripts.

## Original author:  Mike Frysinger
## License:  GPL version 3 or newer

syntax sh "(\.sh|(^|/|\.)(a|ba|c|da|k|mk|pdk|tc|z)sh(rc|_profile)?|(/etc/|(^|/)\.)profile)$"
header "^#!.*/(((env|busybox)[[:blank:]]+)?(a|ba|c|da|k|mk|pdk|tc|z)?sh|openrc-run|runscript)\>"
header "-\*-.*shell-script.*-\*-"
magic "(POSIX|Bourne-Again) shell script.*text"
comment "#"

linter dash -n

# Function declarations.
color brightgreen "^[[:alnum:]_-]+\(\)"

# Keywords, symbols, and comparisons.
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 "[][{}():;|`$<>!=&\]"
color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"

# Short and long options.
color brightmagenta "[[:blank:]](-[[:alpha:]]|--\<[[:alpha:]-]+)\>"

# Common commands.
color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|cut|echo|env|grep|head|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|sort|tail|tar|touch|umask|unset)\>"
color normal "[.-]tar\>"

# Basic variable names (no braces).
color brightred "\$([-@*#?$![:digit:]]|[[:alpha:]_][[:alnum:]_]*)"
# More complicated variable names; handles braces and replacements and arrays.
color brightred "\$\{[#!]?([-@*#?$!]|[[:digit:]]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:blank:]]*[[:alnum:]_]+[[:blank:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"

# Comments.
color cyan "(^|[[:blank:]])#.*"

# Strings.
color brightyellow ""([^"\]|\\.)*"|'([^'\]|\\.)*'"

# Trailing whitespace.
color ,green "[[:space:]]+$"