stdlib.sh
stdlib.sh copied to clipboard
Changes to allowable syntax and 'nounset' behaviour in bash-4.4 break stdlib.sh :(
In bash-4.3 and prior, it was possible to use ${!var:-} to reference the variable whose name is stored in var indirectly, whilst not returning an unbound variable error if nounset is enabled.
bash-4.4 removes this: the above syntax is no longer valid and the only way to safely reference a possibly-unset indirect variable is to either disable nounset or to eval the check/assignment.
Further, ${#array[@]:-} is no longer accepted syntax - need to check wether nounset breaks if referencing ${#array[@]} when array is unset or empty.
... and Apple's autocorrect implementation is still horrendous