#!/bin/bash array_a=() array_b=() if :; then :; fi
:sy on and filetype=sh.array_a=() and array_b=() should be highlighted the same but aren't.
The array_b=() gets highlighted the same as if it were a function declaration, i.e. array_b() { ...; }.
I did a git bisect which let me know it was 12f6f20 that introduced this issue.
9.2.0433
Operating System: Slackware Linux
Terminal: PuTTY for Windows
Value of $TERM: screen.xterm-256color
Shell: Bash 5.3
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
Well, = is not a metacharacter etc. in Bash (v5.3.9), and it
appears array_b= is a word, which is within rule 7b.
Try patching your example as follows:
--- 20183.bash +++ 20183_.bash @@ -1,4 +1,7 @@ #!/bin/bash +set -o posix array_a=() array_b=() -if :; then :; fi +if :; then echo $1; fi +array_b[0]="$1" +array_b= ${array_b[0]}
and then run with it:
./20183_.bash ./20183_.bash
I guess we can make such ambiguous recognition configurable
via a global variable, e.g. g:sh_not_in_bash_function_name,
and support a string of arbitrary characters, e.g. ][=, for
its value; and then let users decide what other characters
in their scripts do not belong to function names in addition
to metacharacters already excluded.
Please advise, @dkearns.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
What's the bug here? array_b= is a function in bash going back to at least version 4.4 and is highlighted correctly.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()