trying to create small bash script. It will connect to multiple servers (inserted in txt file) and send a command, then output will be in output.txt.
Seems it doesn't work, I have something bad. Can you show me the right way?
script.sh
while read -r line
do
echo "Connecting to $line"
sshpass -p mypassword ssh -o StrictHostKeyChecking=no user@$line "/ls >> output.txt;
done < "servers.txt"