I want to pre- and postfix an array in bash similar to brace expansion.
Say I have a bash array
ARRAY=( one two three )
I want to b
Your last loop could be done in a whitespace-friendly way with:
EXPANDED=() for E in "${ARRAY[@]}"; do EXPANDED+=("prefix_${E}_suffix") done echo "${EXPANDED[@]}"