Running full commands through remote ssh [duplicate]
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: how to use ssh to run shell script on a remote machine? I am trying to make a bash script that runs on my remote server's daily cron jobs to automatically login through ssh to another unix box, run a few commands and then leave. #!/bin/bash ssh machinehost.com -l admin -p 2222 "/usr/bin/find /share/Public/backups/set0 -mtime +14 | xargs rm -f; /usr/bin/find /share/Public/backups/set1 -mtime +4 | xargs rm -f;