Imagine that I created an array like this:
IFS="|" read -ra ARR <<< "zero|one|||four"
Now
echo ${#ARR[@]} > 5 echo "${ARR[@]}" > zero one four echo "${ARR[0]}" > zero echo "${ARR[2]}" >
The question is how to replace empty elements with another line?
I tried
${ARR[@]///other} ${ARR[@]//""/other}
none of them worked.
I want this as a conclusion:
zero one other other four
source share