I want to put two commands together

I need the script to login:

ssh root@

Then I need to the script to run (while logged in to root@ via ssh ):

find /var/mobile/Media/Music/ -name "*.mp3" -exec ln -s {} /var/mobile/Media/Music/"All Songs" \;

You can include a command to run on the remote machine as the last argument to ssh

ssh root@ 'find /var/mobile/Media/Music/ [...]'
| improve this answer | |
  • Worked perfectly!! – era878 Mar 20 '11 at 20:16

You can try:

sshpass -p YOUR_PASS_HERE ssh root@ find /var/mobile/Media/Music/ -name "*.mp3" -exec ln -s {} /var/mobile/Media/Music/"All Songs" \;

Cheers, André Gondim http://andregondim.eti.br

| improve this answer | |
  • Providing password on the command line is not very secure. It's much better to use the public key authentication in such cases. – Adam Byrtek Mar 21 '11 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.