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.
Log in to post a comment.