How can I execute all these commands in 1 spawn?
These are the commands:
sudo du -ckhx /opt/ | sort -rh | head -10
sudo du -ckhx /usr/ | sort -rh | head -10
sudo du -ckhx /var/ | sort -rh | head -10
This is the spawn command:
spawn ssh -o StrictHostKeyChecking=no $username@$ip $commands
After the spawn, I'm using expect for the password...
I know I can assign them to 1 variable, such as:
set commands "sudo du -ckhx /opt/ | sort -rh | head -10 && sudo du -ckhx /usr/ | sort -rh | head -10 &&..."
but it will be so long if I have many of those commands (for some other directories I want).
Thanks!