• + 0 comments

    readarray -t array echo "${array[@]/*[aA]*/}" | xargs

    1. elements in the array that containing 'a' or 'A', will be replaced by ' '(space).
    2. xargs command trims leading and trailing spaces

    another approach: readarray -t array printf '%s\n' "${array[@]}" | grep -Ev "a|A"

    here printf prints each array element in a new line, The grep command here filters out 'a' or 'A'