#!/bin/bash
expect <<END
spawn ssh -o user@remote_ip
expect "password"
send "my_pass\r"
expect eof
END
cd /var/www/html/node_project/
##npm init -y
npm install
##node index.js
I want run some commands right after login into remote server. I can login successfully, but 2 or 3 seconds later, it automatically logout me from the remote server. How can I make it wait until all of my commands run and execute successfully?