I want to print all the string in the array delimited with comma
#! /bin/bash
clear
echo -e "Enter the list of hosts to print statement:\n"
readarray hosts
echo "======================================================="
echo -e "Enter the list to print"
echo "======================================================="
for i in ${hosts[@]}
do
id="${i[@]}";echo [ ${i// /, } ]
echo $id
done
If these inputs
afrid.google.com
farid.google.com
My expected results is
[ "afrid.google.com", "farid.google.com" ]
But My result is
[ farid.google.com ]
farid.google.com
[ farid.google.com ]
farid.google.com
jqutility.??field. See the answer that someone posted.