[NTLUG:Discuss] ssh and command macros

Jack Snodgrass mylinuxguy at gmail.com
Sat Mar 12 13:32:47 CST 2005


I know I can do something like
ssh remote_host "cd /tmp; ls -lart"
and it will connect me to remote_host, cd to the /tmp directory and then 
run the ls -lart command. when it's done, it disconnects me and I end
up back where I started. 

How can I do something like 
ssh remote_host "cd /tmp" 
and end up in the /tmp directory on the remote_host? I don't want 
to just run the command and exit. 

In my scenario... I may find myself on hostA in /build/dir/1. I want to 
be on hostB in that same directory. So... I want to ssh hostB but 
get dumped into /build/dir/1 instead of the 'home' directory. 

Does anyone have any ideas? Is there a ssh option I missed 
to run a command and stay logged into the remote host? 

Thanks - jack




More information about the Discuss mailing list