You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
srcshelton
changed the title
Changes to allowable syntax and 'nounset' behaviour in bash-4.4 break sodlib.sh :(
Changes to allowable syntax and 'nounset' behaviour in bash-4.4 break stdlib.sh :(
Jan 18, 2018
In bash-4.3 and prior, it was possible to use
${!var:-}
to reference the variable whose name is stored invar
indirectly, whilst not returning anunbound variable
error ifnounset
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 wethernounset
breaks if referencing${#array[@]}
whenarray
is unset or empty.The text was updated successfully, but these errors were encountered: