Pattern: Use of undefined array reference
Issue: -
Arrays are supported in bash
and ksh
, but not in dash
or POSIX sh
. Either switch to a shell that supports them, or rewrite your script without relying on arrays. This may not be straight forward.
Example of incorrect code:
#!/bin/sh
var=(foo bar)
echo "${var[1]}"
Example of correct code:
#!/bin/bash
var=(foo bar)
echo "${var[1]}"