Functions for handling bash arrays
See the latest release for instructions.
Checks if an element is in an array
local arr=(1 "a b" 2)
if contains_element "a b" "${arr[@]}"; then
printf "'a b' is in arr"
else
printf "'a b' is not in arr"
fi
Joins all elements in the array into a single string using separator
local arr=(1 "a b" 2)
printf "arr joined with - is '%s'" "$(join_by - "${arr[@]}")"