In the part of my script, I need to make ssh to a host and delete the elements of an array. In my current code for each element of the array I need to make ssh to host which takes time. I want to make ssh to the host at one time and then delete all elements of the array. How can I improve my below code from performance point of view?
for x in $Array
do
echo "Value of array are : $x"
ssh [email protected] "rm -rf $x"
done