Alternately, you could base it on one of the third-party IRB
replacements, like pry, ripl, dietrb, etc. (pry already has
commands like cd
.)
Pry however does not aim to replace bash.
To work on a Ruby UNIX command shell.
I am working on something similar, but it will be a hybrid
shell. It will be somewhat similar to bash in some ways,
and somewhat similar to irb in other ways, although bash-like
syntax will have priority over ruby-like syntax.
I do not think this has already been done yet.
It always depends on how much one thinks it is finished. 
There was an even older version of Rush, by a guy from South Africa.
I remember there were drop-down boxes, in colours, in ruby-ncurses,
when one was typing something like “foo”.<TAB WAS PRESSED HERE, THEN THE
DROP DOWN BOX SHOWED UP>
It was quite awesome. 
Sadly the project died.
I imagine the ability to use basic commands like cd, ls, echo from
Ruby and also to use controls like >, |, etc. For sysadmins like
me, I think this might be a very useful tool!
Sure. I myself write ruby scripts rather than shell scripts these
days. The more ruby I can use, the better.
My first approach was to try pass ruby-bits to eval and
program execution to popen.
Eval is too annoying to use IMHO.
Sadly the ruby world has embraced it and extends it further,
with crap like class_eval or module_eval or grandma_eval.
It leads to an overcomplicated design (not always, mind you. I
am using eval myself to use a dynamic configuration object
for my projects, so that a user can extend the configuration
at runtime in any way he or she wants to.)
My current thought is that it will be a lot easier to simply
override the class Irb.
I dont know. I hate IRB. It is underdocumented and ugly.
It can only be recommended for people to instead use pry.
At least that is documented, and it has its own IRC channel
(where you can go, except when you get banned grin)
I’m not sure if this is a bad idea as my code might
become tied to a specific version of ruby/irb.
Your code will be tied to the ruby version anyway. And
IRB is just trying to eval that ruby version. But IRB
is really ugly … if you have luck extending your code
with IRB, I am curious how you did so. 
I’m wondering if anyone else has thought about this problem
and cares to give me any advice/suggestions.
Well, I tried so, and I am still trying to.
This is how my pseudo-shell looks right now:
http://img20.imageshack.us/img20/7564/uploadt.png
Tons of things are still missing though.
If anyone is interested in collaboration,
we could use github.
I am interested in collaboration. My profile is at
https://github.com/shevegen
My pseudo-shell is at https://github.com/shevegen/Diamond-Shell
but beware, I have not updated it for 2 months (but I
change the local code almost daily) - and it still does
not work for anyone else, only for me. I’ll fix that one
day, but it is just a hobby, so I can’t invest a lot of
time into it - individual components may be re-used by
others though perhaps, hence why collaboration may be
interesting.
Where are you? 