diff options
-rw-r--r-- | bash.md | 30 |
1 files changed, 24 insertions, 6 deletions
@@ -1,12 +1,30 @@ GNU `bash` ========== -1. (Associative) arrays - * Yes: +(Associative) arrays +-------------------- - func ${arr[@]+"${arr[@]}"} +### Expansion - * No: +Yes: - func "${arr[@]}" # doesn't work with `nounset` - func "${arr[@]+"${arr[@]}"}" # doesn't work with ('') + func ${arr[@]+"${arr[@]}"} + +No: + + func "${arr[@]}" # doesn't work with `nounset` + func "${arr[@]+"${arr[@]}"}" # doesn't work with ('') + +### `unset` + +Yes: + + unset -v 'arr[$i]' + +No: + + unset -v arr[x] # globbing + unset -v arr[$i] # the same problem + quoting + unset -v 'arr["x"]' # doesn't work for some reason + unset -v 'arr["]"]' # the same as above; just to highlight the problem with funny characters in array indices + # insightful discussion: https://lists.gnu.org/archive/html/help-bash/2016-09/msg00020.html |