[kwlug-disc] ssh into remote with initial command, and stick!

Paul Nijjar paul_nijjar at yahoo.ca
Thu May 23 02:01:25 EDT 2013

Okay. If you hate screen then here is a way to do it (tested just

- In the target account, make a file called "top-bashrc". Put it in
  the home folder. Here are the file contents: 

source ~/.bashrc

- Now run the following to launch bash with the given configuration

ssh -t me at mine /bin/bash --rcfile top-bashrc

For me (bash 4.1.5, packaged with Debian 6.0.7), top then runs.
Because top is launched as a child process in the top-bashrc file,
when that child process ends then bash takes over, and I am left with
a prompt. 

I am not certain what the problem with your "bash -lisc top" example
was. I have a feeling it has something to do with bash treating the
further commands as a script, and exiting when the script is finished
(just as a bash shell will exit when running a text script). But I
could be way off base on this, and I will happily let the
shell-process experts on the list correct me. 

- Paul 

I'm speaking at http://ignitewaterloo.ca : June 13

More information about the kwlug-disc mailing list