sh.nanorc 1.1 KB

12345678910111213141516171819202122232425262728
  1. ## Here is an example for Bourne shell scripts.
  2. syntax "sh" "\.sh$"
  3. header "^#!.*((ba|da|k|pdk)?sh[-0-9_]*|openrc-run|runscript)"
  4. magic "(POSIX|Bourne.*) shell script text"
  5. linter dash -n
  6. icolor brightgreen "^[0-9A-Z_]+\(\)"
  7. color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
  8. color green "\<(declare|eval|exec|export|let|local)\>"
  9. color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
  10. color green "-[Ldefgruwx]\>"
  11. color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
  12. 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)\>"
  13. # Basic variable names (no braces).
  14. color brightred "\$[-0-9@*#?$!]" "\$[[:alpha:]_][[:alnum:]_]*"
  15. # More complicated variable names; handles braces and replacements and arrays.
  16. color brightred "\$\{[#!]?([-@*#?$!]|[0-9]+|[[:alpha:]_][[:alnum:]_]*)(\[([[:space:]]*[[:alnum:]_]+[[:space:]]*|@)\])?(([#%/]|:?[-=?+])[^}]*\}|\[|\})"
  17. # Comments.
  18. color cyan "(^|[[:space:]])#.*$"
  19. # Strings.
  20. color brightyellow ""(\\.|[^"])*"" "'(\\.|[^'])*'"
  21. # Trailing whitespace.
  22. color ,green "[[:space:]]+$"