How to read array and loop server selection and deployment I have configured jenkins parameter deployment job using active choices parameterize plugin. In my dev server section have two servers called, 192.168.94.139, 192.168.94.140

 

I want to read this array input and deploy to both servers. As an example if I select both servers artifacts should be deployed to both servers. How can I read those inputs to fulfill my requirement. Until this point I wrote an array to read inputs but it prints like this 


  192.168.94.139,192.168.94.140


my_array=($SERVER_SELECTION)
for i in ${my_array[@]} 
do 

   echo $my_array

done
Look this: 

#!/bin/bash
#Get servers list
set -f
string=$DEPLOY_SERVER
array=(${string//,/ })
for i in "${!array[@]}"do    
      echo "Deploy project on server ${array[i]}"    
done


I found this link