I am trying to create a new array using for loop
Images="alpine ubuntu centos"
Image_tags="$(for i in $Images; do
r_madoori1/$i
done)"
echo $Image_tags
I am expecting
Image_tags="r_madoori1/alpine r_madoori1/ubuntu r_madoori1/centos"
instead i am getting below error
./shell.sh: line 7: r_madoori1/alpine: No such file or directory
./shell.sh: line 7: r_madoori1/ubuntu: No such file or directory
./shell.sh: line 7: r_madoori1/centos: No such file or directory
sh. Butstring="item1 item2 item3"isn't an array at all (that would bearray=( item1 item2 item3 )), so it's not clear what you're asking for.echo $BASH_VERSIONto check this. Also, you don't have any array in your code, and in the title of your question speaks of a list, not an array. Please be clear in what you want to achieve.printf '%s 'in front ofr_madoori1/$i.