I've to run a command
iptables --flush in 100+ servers. I don't have root credentials, but have sudo access for my account. So I come up with a below script to run the command in all servers.
I added the servers names in the flushhosts file.
[root@~]# cat testscript.sh > for i in `cat /flushhosts` > > do > > sshpass -p 'Mypwd' ssh -t username@$i sudo /sbin/iptables --flush > > cat << EOF || "Mypwd" > > done [root@~]# ./testscript.sh ./testscript.sh: line 6: syntax error: unexpected end of file
I couldn't find what I'm missing in the script.