bugGNU nano - Bugs: bug #29943, slightly improve bash shell syntax...


bug #29943: slightly improve bash shell syntax highlighting

Submitted by:  None
Submitted on:  Sat 22 May 2010 07:55:58 PM UTC  
Severity: 3 - NormalStatus: Fixed
Assigned to: Benno Schulenberg <bens>Open/Closed: Closed

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sun 23 Feb 2014 04:17:21 PM UTC, comment #1:

Agreed. Colouring "" strings before variables, and those before '' strings, and all those before comments is a nicer order. It's in SVN now. Thanks.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sat 22 May 2010 07:55:58 PM UTC, original submission:

I modified /usr/share/nano/sh.nanorc to better highlight for Bash (IMO)

Here are the changes:

When a variable is within double quotes ("") it gets it's proper red colour, but if it is within single quotes ('') it gets quote colours. Any quotes within a line comment wont get quote colours.

Here's my fixed file.

## Here is an example for Bourne shell scripts.
syntax "bash" "\.sh$"
header "^#!./(ba|k|pdk)?sh[-0-9_]"
icolor brightgreen "^[0-9A-Z_]+\(\)"
color green "\<(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)\>"
color green "(\{|\}|\(|\)|\;|\]|\[|`|\\|\$|<|>|!|=|&|\|)"
color green "-[Ldefgruwx]\>"
color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
color brightblue "\<(cat|cd|chmod|chown|cp|echo|env|export|grep|install|let|ln|make|mkdir|mv|rm|sed|set|tar|touch|umask|unset)\>"
color brightyellow ""(\\.|[^"])*""
icolor brightred "\$\{?[0-9A-Z_!@#$*?-]+\}?"
color brightyellow "'(\\.|[^'])*'"
color cyan "(^|[[:space:]])#.*$"
color ,green "[[:space:]]+$"




(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by bens (Posted a comment)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 23 Feb 2014 04:17:21 PM UTCbensStatusNone=>Fixed
      Assigned toNone=>bens
      SummaryBash shell syntax highlighting=>slightly improve bash shell syntax highlighting

    Back to the top

    Powered by Savane 3.1-cleanup1