Nano: how to obtain syntax highlighting? I have a default installation of nano under /usr/bin/, and I am trying to make nano highlight the bash scripting language code.

I have been searching around, but I had no success: I got always some errors, or simply doesn't work. For example, I have tried to download the following repository from Github github.com/nanorc/nanorc.git with the following command:

git clone https://github.com/nanorc/nanorc.git


and then follow the steps in this post, but I have had errors because some command inside the files are not recognised. In particular, if I add this line include ~/nanorc/shell.nanorc to my file ~/.nanorc, where the file shell.nanorccontains:

syntax "sh" "\.sh$" "\.bash$" "bashrc$" "bash_profile$"
header "^#!.*/(env +)?(ba|k|pdk)?sh[-0-9_]*( |$)"

FUNCTION: "^[A-Za-z0-9_+-]+[[:space:]]*\(\)"
KEYWORD:  "\&lt;(case|do|done|elif|else|esac|fi|for|function|if)\&gt;"
KEYWORD:  "\&lt;(in|select|then|time|until|while)\&gt;"
FUNCTION: "\&lt;(echo|exit|export|let|local|read|return|set|shift|umask|unset)\&gt;"
FUNCTION: "\&lt;(source)\&gt;"
OPERATOR: "[{}()&lt;&gt;!=&amp;|;`$]|\\|\[|\]|-(eq|ne|gt|lt|ge|le|s|n|z)\&gt;"
STRING:   ""(\\.|[^"])*""
VARIABLE: "\$\{?[A-Za-z0-9_!@#$*?-]+\}?|`[^`]*`"
STRING:   "'(\\.|[^'])*'"
ESCAPE:   "\\.?"
+HASHCOMMENT
+TODO
+LINT


It seems that these previous commands, such STRING, ESCAPE, etc, are not recognised.

How would you set syntax highlighting for nano, at least for bash?
Install the latest version of nano with homebrew:


Install homebrew: https://brew.sh/
Install nano: brew install nano
Add this line to ~/.nanorc. That directory has all the syntax highlighting definition files.

include "/usr/local/share/nano/*.nanorc"