Why when using sshpass
in a loop the first sshpass
executes commands, while the next does not?
for element in "${a[@]}"
do {
echo "$element"
sshpass -p "omg" ssh root@$element 'ls'
}
done
I found a fix:
for element in "${a[@]}" do
echo "$element"
export SSHPASS='omg'
sshpass -e ssh -o StrictHostKeyChecking=no root@$element 'ls'
unset SSHPASS
done
a
is?