Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm new to shell scripting and I tried to have a script ssh into another machine and perform some commands. I have the public/private key set up so I'm not prompted for a password when I ssh into the other machine manually. The problem is that the scripts stops after sshing into the other machine unless the ssh is exited. In the code below, the second and third line are not ex

ssh ''
echo "Successfully logged in?"
share|improve this question
up vote 1 down vote accepted

That's the way shell scripts work. Given a file with

ssh ''
echo "Successfully logged in?"

First the shell executes the command on the first line, when that command is finished, it executes the command on the second line.

You may want to do something like this (untested)

ssh '; echo "Successfully logged in?"; pwd'
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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