Can you use irb in place of shells like bash or rc?
Can you use irb in place of shells like bash or rc?
not really, but kinda, yeah.
you can do "system ('any unix command')" from inside irb really
easily, and you could also set up a method which automatically took
any input you gave irb and passed that along to system, but you
wouldn't get tab-completion, you'd have to manually print the strings
you received back - they come back with newline escape sequences
rather than newlines - and I really don't know how you would be able
to get system (or backticks, which do almost exactly the same thing)
to load your .profile or .foo_shrc files.
you can do pretty much anything you want in Unix from within irb, but
actual Unix shells remain the best way to do it. (although I think
there was an actual irb shell written, so I could be wrong.)
···
--
Giles Bowkett
Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com
Some day, some day, somebody smarter and more ambitious than me will build that Ruby-native shell with all the joy of Ruby and command line tools integrated...
···
On Dec 1, 2007, at 6:45 PM, Giles Bowkett wrote:
Can you use irb in place of shells like bash or rc?
not really, but kinda, yeah.
you can do "system ('any unix command')" from inside irb really
easily, and you could also set up a method which automatically took
any input you gave irb and passed that along to system, but you
wouldn't get tab-completion, you'd have to manually print the strings
you received back - they come back with newline escape sequences
rather than newlines - and I really don't know how you would be able
to get system (or backticks, which do almost exactly the same thing)
to load your .profile or .foo_shrc files.you can do pretty much anything you want in Unix from within irb, but
actual Unix shells remain the best way to do it. (although I think
there was an actual irb shell written, so I could be wrong.)-- Giles Bowkett
Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com
John Joyce wrote:
Can you use irb in place of shells like bash or rc?
not really, but kinda, yeah.
you can do "system ('any unix command')" from inside irb really
easily, and you could also set up a method which automatically took
any input you gave irb and passed that along to system, but you
wouldn't get tab-completion, you'd have to manually print the strings
you received back - they come back with newline escape sequences
rather than newlines - and I really don't know how you would be able
to get system (or backticks, which do almost exactly the same thing)
to load your .profile or .foo_shrc files.you can do pretty much anything you want in Unix from within irb, but
actual Unix shells remain the best way to do it. (although I think
there was an actual irb shell written, so I could be wrong.)--
Giles BowkettPodcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.comSome day, some day, somebody smarter and more ambitious than me will
build that Ruby-native shell with all the joy of Ruby and command
line tools integrated...
Thanks to both of you and I can only hope that somebody comes along soon. I
wish I had the experience and skill to do it my self, but multiple failure
with other big and ambitious projects I took on taught me some humility.
···
On Dec 1, 2007, at 6:45 PM, Giles Bowkett wrote:
John Joyce wrote:
to get system (or backticks, which do almost exactly the same thing)
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.comSome day, some day, somebody smarter and more ambitious than me will
build that Ruby-native shell with all the joy of Ruby and command
line tools integrated...
Not terribly smart and definitely not ambitious here, but this thread is
a strange happenstance since I just dusted off the rs repository. This
is
probably a good place to take a peek:
http://repos.kittensoft.org/rs/doc/HOWTO.using
http://repos.kittensoft.org
I have not had the time to work on rs in a long, long while but the
codebase looks OK still and the functionality is fairly nice. The
idea was to first gradually implement as powerful as possible shell
in pure Ruby syntax and then possibly later offer a parser on top of
it (so that one could e.g. use /tmp/foo rather than '/tmp/foo'.)
The current syntax was left as unobtrusive by default as possible.
FileSystemObjects, for example, cannot be implicitly created from
Strings (this is left for the user to do, just set up a #method_missing
handler) but overall it is pretty flexible. The above link has
some examples but the one I have often used:
(ls | tr('a-z A-Z')).each {|f| p f.reverse}
Anyway.
Perhaps more news in the near future!
This is one of those questions where consulting with rubyforge.org can
be helpful.
http://rubyforge.org/projects/rbsh/
I can't speak for it, I haven't really used it.
Cameron
A group of developers, including the author of rbsh, recently got
together for just such a project.
http://rubyunix.rubyforge.org/
We're still working out the design and putting together everyone's
ideas, but an interactive shell, ability to run UNIX shell scripts,
and other such things are among our goals.
Daniel Brumbaugh Keeney
···
On Dec 1, 2007 9:55 PM, Robert Jones <robertjones21@hotpop.com> wrote:
> Some day, some day, somebody smarter and more ambitious than me will
> build that Ruby-native shell with all the joy of Ruby and command
> line tools integrated...
Some day, some day, somebody smarter and more ambitious than me will
build that Ruby-native shell with all the joy of Ruby and command
line tools integrated...
hehe working on that with my limited abilities...
Unfortunately, aside from time problems, I found two stop things:
First, I need something that can replace irb easily, so that you
get all the important functionality of irb and which has
sufficient docu to allow "normal" programmers unterstand
what is going on (understanding how IRB works is possible,
but i found it takes a lot of time, and isnt as fun as
starting from scratch)
Something that is as flexible as irb-in-a-browser too,
but for some reason I didnt find this very easy...
Second, I still have no real way on how to do piping of
objects/data with a ruby shell. (After all we are talking of a
real shell, no? One like in bash where you can apply filters...)
And also... ruby-ncurses would be nice to have, so that we
can get zsh-like "borders" around a prompt (and RPROMPT etc..
etc.. etc..)
But for now its a lot easier to replace all t he simple unix
tools in pure ruby... thats not that difficult, just
quite some work
"but you wouldn't get tab-completion"
Well you can, with Readline.readline and using a proc
object for tab completion. The docu is a little bit weird,
but with a little help i got that to work.
···
--
Posted via http://www.ruby-forum.com/\.
That's extremely nifty. I also like the name: rush. I recommend using
the 2112 cover art for maxiumum effect.
···
On 12/3/07, Daniel Brumbaugh Keeney <devi.webmaster@gmail.com> wrote:
On Dec 1, 2007 9:55 PM, Robert Jones <robertjones21@hotpop.com> wrote:
> > Some day, some day, somebody smarter and more ambitious than me will
> > build that Ruby-native shell with all the joy of Ruby and command
> > line tools integrated...A group of developers, including the author of rbsh, recently got
together for just such a project.
http://rubyunix.rubyforge.org/We're still working out the design and putting together everyone's
ideas, but an interactive shell, ability to run UNIX shell scripts,
and other such things are among our goals.Daniel Brumbaugh Keeney
--
Giles Bowkett
Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com
excellent! can't wait for it.
···
On Dec 3, 2007 8:50 AM, Daniel Brumbaugh Keeney <devi.webmaster@gmail.com> wrote:
On Dec 1, 2007 9:55 PM, Robert Jones <robertjones21@hotpop.com> wrote:
> > Some day, some day, somebody smarter and more ambitious than me will
> > build that Ruby-native shell with all the joy of Ruby and command
> > line tools integrated...A group of developers, including the author of rbsh, recently got
together for just such a project.
http://rubyunix.rubyforge.org/We're still working out the design and putting together everyone's
ideas, but an interactive shell, ability to run UNIX shell scripts,
and other such things are among our goals.Daniel Brumbaugh Keeney
"but you wouldn't get tab-completion"
Well you can, with Readline.readline and using a proc
object for tab completion. The docu is a little bit weird,
but with a little help i got that to work.
Is there a way to integrate that with irb? A Unix shell with .irbrc
special sauce would be pretty nifty. Although I have to admit I
haven't got the hang of it yet:
! ruby ruby_shell.rb
ls (tab)
.svn/ ruby_shell/ ruby_shell.rb
ls ../README
ls -l !$
ls -l ../README
ls: fts_open: No such file or directory
···
--
Giles Bowkett
Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com
Hello --
···
On 03/12/2007, Giles Bowkett <gilesb@gmail.com> wrote:
That's extremely nifty. I also like the name: rush. I recommend using
the 2112 cover art for maxiumum effect.
Some of us are working on the rubyunix project:
http://rubyunix.rubyforge.org/
-- Thomas Adam
I started to create these tools some years ago, see:
http://creo.hu/~csaba/ruby/pope/
Pope stands for "Powerful Piping Environment", a ruby implementation
of
the simple Unix IPC constructs (mainly pipes), and atop of it Urb,
an Irb hack which can be used as a shell (it has job control)
and features some syntax sugar to make this easy:
- basic Urb listener can do pipes like
_("ls").|("grep '\.rb$'")_
or if you need to be more exact (ie., you don't wanna rely on
shellish command line parsing), you can do it like:
_(["lame", "--decode", "Star Spangled Banner.mp3"]).|("oggenc -
ssb.ogg")._
Irb completion is enhanced to make such lines easy to type.
- there is an other listener called Pidginsh, which can started with
"pidginsh"
(and be left with ^D). It partially groks Bourne shell syntax and
dynamically
translates shell commands to standard Urb calls. So in pidginsh
ls | grep '\.rb$'
will work and is equivalent with the above cited Urb command.
Alas, I didn't have the energy to finish this project and make it
really shine.
Even so, it's usable in its current form, I use it all the time
(however, you
probably won't end up like this, due to the lack of documentation :
(( ).
This code is available via Mercurial from http://mercurial.creo.hu/repos/pope/
or as a direct tarball download: http://mercurial.creo.hu/repos/pope/?archive/tip.tar.gz
Csaba
···
On Dec 2, 7:05 pm, Marc Heiler <sheve...@linuxmail.org> wrote:
> Some day, some day, somebody smarter and more ambitious than me will
> build that Ruby-native shell with all the joy of Ruby and command
> line tools integrated...
Second, I still have no real way on how to do piping of
objects/data with a ruby shell. (After all we are talking of a
real shell, no? One like in bash where you can apply filters...)
> "but you wouldn't get tab-completion"
> Well you can, with Readline.readline and using a proc
> object for tab completion. The docu is a little bit weird,
> but with a little help i got that to work.Is there a way to integrate that with irb?
Tab completion? Already in there. In .irbrc...
require 'irb/completion'
A Unix shell with .irbrc
special sauce would be pretty nifty. Although I have to admit I
haven't got the hang of it yet:! ruby ruby_shell.rb
> ls (tab)
svn/ ruby_shell/ ruby_shell.rb
> ls ../README
> ls -l !$
> ls -l ../README
ls: fts_open: No such file or directory--
Giles BowkettPodcast:http://hollywoodgrit.blogspot.com
Blog:http://gilesbowkett.blogspot.com
Portfolio:http://www.gilesgoatboy.org
Tumblelog:http://giles.tumblr.com
Regards,
Jordan
···
On Dec 2, 1:29 pm, Giles Bowkett <gil...@gmail.com> wrote:
Thomas Adam wrote:
Hello --
That's extremely nifty. I also like the name: rush. I recommend using
the 2112 cover art for maxiumum effect.Some of us are working on the rubyunix project:
http://rubyunix.rubyforge.org/
-- Thomas Adam
Have you guys also looked at the hotwire project (a new python-shell)
http://code.google.com/p/hotwire-shell/
It has some interesting ideas.
Edwin
···
On 03/12/2007, Giles Bowkett <gilesb@gmail.com> wrote:
--
Posted via http://www.ruby-forum.com/\.
Once again, since people are really getting into this, I ENOURAGE YOU ALL TO JOIN THE RUBYUNIX MAILING LIST.
Thanks,
Ari
Tab completion? Already in there. In .irbrc...
require 'irb/completion'
I know - got it already. Talking abut Unix tab completion. (That
happens in ruby_shell, but I don't know how.)
···
--
Giles Bowkett
Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com
I still think if it borrows lots from bash, it should be called rash, not rush.
http://www.scsh.net/ likewise, though the focus there is more on
scripting than interactivity.
martin
···
On Dec 3, 2007 3:15 PM, Edwin Van leeuwen <edder@tkwsping.nl> wrote:
Have you guys also looked at the hotwire project (a new python-shell)
Google Code Archive - Long-term storage for Google Code Project Hosting.
It has some interesting ideas.
Once again, since people are really getting into this, I ENOURAGE YOU
ALL TO JOIN THE RUBYUNIX MAILING LIST.
You know, this is an interesting discussion, it's too bad there isn't
a mailing list we could take this to which is totally focused on this
topic and this project. Oh well. I guess I'll make myself a hamburger.
···
--
Giles Bowkett
Podcast: http://hollywoodgrit.blogspot.com
Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org
Tumblelog: http://giles.tumblr.com