Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#245 Bash, #, and ^G

open
nobody
None
5
2008-11-04
2008-11-04
No

In Bash, the '#' character means that the rest of the line is a comment, except when it means something else...

I went through the Bash manual looking for different uses of '#'. The attached file has a function for every different use I found. Try hitting ^G on each of the curly brackets. Delimiter matching works fine in functions "f" and "l". I expected "l" to work, but I was a bit surprised about "f". For all the others, the first '}' is ignored because of the preceding '#'.

Functions "k" and "m" are also not handled properly by the syntax highlighter.

"!#" doesn't do much in a script. It is meant for an interactive shell, but it is accepted in a script without being reported as a syntax error. Without the '!', it is reported as a syntax error.

A use of '#' like that in function "h" is what bit me in the wild.

Related

Patches: #106

Discussion

  •  
    Attachments
  • Joe Allen
    Joe Allen
    2008-11-04

    Ugh.. I need a user definable state machine for ^G.

     
  • If only we could leverage the existing state machine... :-)

    See patch 3459260.