Search code examples
arraysbashvariablesphpstorm

PHPStorm complains on simple use of array variables


Anyone know how to fix "Simple use of array variables" in BASH?

for instance:

# will complain $paths[@] is a simple array variable
for path in "${paths[@]}"; do 
    [ ! -d "${path}" ] && mkdir -p "${path}"
done

I have about 10 notices in my code I would like to take care of


Solution

  • This looks like a bug in bashsupport for IDEA / PHPStorm / etc.

    It seems that the code only checks for arithmetic expressions between the brackets, so paths[1+2] works but paths[@] does not as it is no arithmetic expression.