How to create list in shell using for loop

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


Read more here: https://stackoverflow.com/questions/68473508/how-to-create-list-in-shell-using-for-loop

Content Attribution

This content was originally published by Rajeshwer wer at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: