My shell is printing the output as shown below.
$ echo ${mount_check[*]} |tr "." "\n"
File system /abc is NOT mounted
File system /xyz is NOT mounted
$
I had tried using echo "${mount_check[*]}"
however that didn't print the output the way I wanted.
I would like the shell print every new line with no space and remove the empty line space as well as shown below.
File system /abc is NOT mounted
File system /xyz is NOT mounted
As requested by David and tripleee adding the full code.
fstable=( $(awk '!/bind|swap|shm/ && $1 !~/#|^$/ && !/^ +$/ { print $2 }' /etc/fstab))
mount_check=($(for mount in "${fstable[@]}"; do
if [[ -z $(findmnt -m "$mount") ]]
then
echo "File system $mount is NOT mounted."
fi
done))