GNU Bash 4.4 seems forgiving when accessing the first element or only element of an array by using just the array name or accessing a variable with array syntax. Both ${var[0]} and ${var[@]} return "Value" when the variable var='Value'.
I can simplify my code by using one of the arrays as a variable when only a variable is needed. For this package I'm more concerned with it not braking with the next Bash update than with portability.
Is it safe to write code that accesses the first element of an array using variable syntax?
declare -a foo='Value'
declare -p var
declare -a var=([0]="Value")
echo ${foo}
Value
"${var[0]}"to access first element.