Tech C**P
14 subscribers
161 photos
9 videos
59 files
304 links
مدرس و برنامه نویس پایتون و لینوکس @alirezastack
Download Telegram
Array and loop in bash script

To define an array you can use a structure like below, be careful that we don't use comma in between:

dbs=( 'test1' 'test2' 'test3' )


Now to loop over the array elements use for:

for your_db in ${dbs[@]}
do
echo $your_db
done

This is it!

#bash #scripting #for #loop #array