tags:

views:

131

answers:

1

So I've got dozens of servers I connect to and want a simple Ruby script that provides me with a list of those servers. Picking one will start up SSH with the proper connection details and let me start using it. That's it!

But, I don't want/need Ruby to keep running. If I did I could use Net::SSH and capture all output and send it back to the user, but this is an extra layer I don't need. I simply want to use Ruby as a "script starter" and then close itself.

Any ideas? I've thought about forking processes but I don't know how I'd attach the terminal to the new ssh one.

I have a simple bash script that does this already, but I want to add more functionality like being able to add to the list, remove servers, etc. all from the command line. I'm sure I could do this with bash as well but I'm much more comfortable with Ruby.

+2  A: 

Maybe exec will do the trick

zaius
A quick test reveals that this will indeed work.
mathepic
Holy crap that worked! I thought for sure that `exec` would just run the task in the background, not actually send you into that process. Thanks dude!
Rob Cameron
No worries! Glad to help!
zaius