From: Csaba Henk Date: 2007-12-05T10:55:04+09:00 Subject: Re: irb and unix shells On Dec 2, 7:05 pm, Marc Heiler 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...) 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