I wonder if you could help me with something that has frustrated me for some time.
There are many XML files for syntax highlighting for use with editors, e.g. gedit and pluma, in the shared area:
/usr/share/gtksourceview-3.0/language-specs
There isn't one for Bash. Most of the time, the workaround is to use the sh syntax highlighting, but there are a couple of problems with using it for Bash. The worst one that I've come across is where command substitution, using quotes, is used within a case block. An example follows:
If you put this into gedit with the sh syntax highlighting, you'll notice that everything after the readlink command is shown as being in quotes — apart from sections that actually are within quotes!Code:#!/bin/bash case ${SOMETHING} in ( 'a' ) FILENAME="$( readlink "${ARG}" )" ;; esac CONFUSING_LINE="case esac"
Having this structure in a long script file leads to the syntax highlighting after this point being useless. Well, worse than useless, because it incorrectly highlights quoted content.
So…
I decided that I'd copy the existing sh.lang to bash.lang, and modify it to work with Bash. It didn't take me long to realise that, despite the file being quite short, I was hopelessly lost. I cannot get my head around how to fix this!
Can you help, please? I'd love to finally fix this and submit it for the many people who have also asked about Bash highlighting in gedit and other editors.
Thank you
Bookmarks