When you declare a variable as either local
or export
ed that in itself is a command that will return success or not.
$ var=$(false)
$ echo $?
1
$ export var=$(false)
$ echo $?
0
So if you wanted to act on the return value of your command (echo "$current_line" | mawk '/.+=.+/ {print $1 }'
), you would be unable to since it's going to exit with 0 as long as the local declaration succeeds (which is almost always will).
In order to avoid this it suggests declaring separately and then assigning:
local key_value
key_value=$(echo "$current_line" | mawk '/.+=.+/ {print $1 }')
This is a shellcheck rule I frequently ignore and IMO is safe to ignore as long as you know you aren't trying to act on the return value of that variable declaration.
You can ignore it by adding the following to the top of your script (Below the hashbang of course):
# shellcheck disable=SC2155