Ruby - How to start an ssh session and dump user into it - no Net::SSH
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.
Maybe exec will do the trick
- http://en.wikipedia.org/wiki/Exec_(operating_system)
- http://ruby-doc.org/core/classes/Kernel.html#M005968
精彩评论