I am attempting to automate several common tasks that I SSH into a remote server to do. For this, I am using PuTTY and its "remote command" option (Connection > SSH) in several saved sessions. My remote command looks something like this:
~/scripts/test; $SHELL -l
The script executed differs per saved session and performs different tasks.
$SHELL -l keeps the PuTTY session active after the script finishes executing.
All this is working perfectly for most scripts I am running. However, I have one that uses a while loop to execute a series of commands until is it terminated with Ctrl+C. The script starts fine, but the PuTTY shell does not remain active once it is terminated.
$SHELL -l doesn't appear to be being executed.
An example script with this behaviour is as follows:
while true; do echo "." sleep 2 done
The following works fine executed manually, I see the expected output from the second command:
~/scripts/test; echo "done"
However, the second command of the PuTTY "remote command" does not execute. Indeed, if I change the remote command to include an
echo, it is not displayed.
~/scripts/test; echo "done"; $SHELL -l
So I guess my question is: why is the second command in the list not executed by the remote command, while it is when running it manually? And, more importantly, what can I do about it?
If it's relevant, I'm running PuTTY on Ubuntu 14.04.