I'm assigning values to an array inside a for loop:
aws_user_roles+=("$aws_role_name")
If I were assigning the values of the array from a command and want to strip the newline I could go:
readarray -t aws_roles < <(...some aws commands...)
My for loop looks something like this:
for ((has_role_index=0;has_role_index<${#aws_user_has_roles[@]};++has_role_index)); do
aws_user_roles+=("$aws_role_name")
declare -p aws_user_roles
done
How can I strip out the newline from the array elements in aws_user_roles and replace it with a space?