stdlib.sh icon indicating copy to clipboard operation
stdlib.sh copied to clipboard

Changes to allowable syntax and 'nounset' behaviour in bash-4.4 break stdlib.sh :(

Open srcshelton opened this issue 7 years ago • 1 comments

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.

srcshelton avatar Jan 18 '18 08:01 srcshelton

... and Apple's autocorrect implementation is still horrendous .

srcshelton avatar Jan 18 '18 08:01 srcshelton