Suspect missing use of local variables

I have some code that looks like this:

declare -a kernel_version

IFS=.-~ read -r -a kernel_version < <(uname -r)
if (( kernel_version[0] >= 5 || (kernel_version[0] >= 4 && kernel_version[1] >=13) )); then
   :
fi

BashSupport Pro (v1.5) is doesn’t seem to recognice that ${kernel_version} has been used and reports it as an unused local variable. If this isn’t already fixed in v2.0, could it be?

Thanks, Bruce

Hi @bus-error,
thanks for reporting! This isn’t fixed yet, but I’ll add that to the list of issues to fix for 2.0.

Joachim

Great, thanks :grinning:

Fixed for 2.0 now. Thanks for reporting!
Variables defined by “read -a var_name” are supported now as well as indexed variable references in arithmetic expressions, e.g. (( kernel_version[0] )), etc.

Great, looking forward to v2.0. I have just upgraded from v1.5 to beta4 to help with the testing. Is this the best channel to report issues?

Thanks for testing! I’ll publish a new beta soon, beta4 has a few issues. I had to add a few things to handle the trial duration of beta builds, but should have this ready soon for a new build.

This forum is fine for your feedback, alternatively you could submit bug reports to https://github.com/Bashsupport-Pro/bashsupport-pro/issues .

Joachim

Hi @bus-error, finally there’s a new beta5 version. It should fix your issue (and a lot more).

If you’re still willing to test the eap builds then I’d be glad if you could do that :slight_smile:

Thanks!
Joachim

Hi Joachim
I have updated to beta5 this morning and can confirm that the issue above is resolved, thanks!
I also see that another issue that was affecting my code, multi-line “To Do” items is also resolved - great.
Cheers
Bruce