executing ssh from shell script

Discussion in 'Linux Networking' started by R C V, Mar 19, 2008.

  1. R C V

    R C V Guest

    I am trying to execute a shell script on a remote machine
    using a shell script on the local machine. I am not getting any
    errors but the remote script is not getting executed.

    Can you please tell me where I am going wrong.
    The local shell script is as follows.

    ssh [email protected] ~/testscripts/copyexecutable

    The copyexecutable script works fine if I ssh into the remote machine
    and execute it from the command prompt.

    R C
    R C V, Mar 19, 2008
    1. Advertisements

  2. The tilda will be expanded by your local shell; try quoting it.

    Robert Harris, Mar 19, 2008
    1. Advertisements

  3. R C V

    Carbon Guest

    If no absolute path is given the default directory in the ssh session
    will be the remote user's home directory. Try

    ssh [email protected] "testscripts/copyexecutable"

    I always quote remote commands out of habit although they shouldn't be
    required unless there are spaces.
    Carbon, Mar 23, 2008
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.