[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

irb and unix shells

Robert Jones

12/2/2007 12:27:00 AM

Can you use irb in place of shells like bash or rc?
35 Answers

Giles Bowkett

12/2/2007 12:45:00 AM

0

> 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.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....

John Joyce

12/2/2007 2:35:00 AM

0


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.bl...
> Blog: http://gilesbowkett.bl...
> Portfolio: http://www.gilesg...
> Tumblelog: http://giles....
>
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...

Robert Jones

12/2/2007 3:50:00 AM

0

John Joyce wrote:

>
> 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.bl...
>> Blog: http://gilesbowkett.bl...
>> Portfolio: http://www.gilesg...
>> Tumblelog: http://giles....
>>
> 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...

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.

Cameron McBride

12/2/2007 3:44:00 PM

0

This is one of those questions where consulting with rubyforge.org can
be helpful. ;)

http://rubyforge.org/proj...

I can't speak for it, I haven't really used it.

Cameron

Marc Heiler

12/2/2007 6:05:00 PM

0

> 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-....

Giles Bowkett

12/2/2007 7:30:00 PM

0

> "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
RubyShell> ls (tab)
svn/ ruby_shell/ ruby_shell.rb
RubyShell> ls ../README
RubyShell> ls -l !$
RubyShell> ls -l ../README
ls: fts_open: No such file or directory

--
Giles Bowkett

Podcast: http://hollywoodgrit.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....

MonkeeSage

12/3/2007 2:21:00 AM

0

On Dec 2, 1:29 pm, Giles Bowkett <gil...@gmail.com> wrote:
> > "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
> RubyShell> ls (tab)
> svn/ ruby_shell/ ruby_shell.rb
> RubyShell> ls ../README
> RubyShell> ls -l !$
> RubyShell> ls -l ../README
> ls: fts_open: No such file or directory
>
> --
> Giles Bowkett
>
> Podcast:http://hollywoodgrit.bl...
> Blog:http://gilesbowkett.bl...
> Portfolio:http://www.gilesg...
> Tumblelog:http://giles....

Regards,
Jordan

Giles Bowkett

12/3/2007 3:22:00 AM

0

> 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.bl...
Blog: http://gilesbowkett.bl...
Portfolio: http://www.gilesg...
Tumblelog: http://giles....

Gowrisankar Narayanan-IC

12/3/2007 3:34:00 AM

0

Hi,

I have downloaded Rails-1.2.6.zip manually as my proxy settings are
restricting Ruby to do it automatically.

Now that Rails-1.2.6.zip is with me.. To which directory should I
extract these files to.=20

Thanks in advance
Gowrisankar. narayan


DISCLAIMER:
This message contains privileged and confidential information and is =
intended only for an individual named. If you are not the intended =
recipient, you should not disseminate, distribute, store, print, copy or =
deliver this message. Please notify the sender immediately by e-mail if =
you have received this e-mail by mistake and delete this e-mail from =
your system. E-mail transmission cannot be guaranteed to be secure or =
error-free as information could be intercepted, corrupted, lost, =
destroyed, arrive late or incomplete or contain viruses. The sender, =
therefore, does not accept liability for any errors or omissions in the =
contents of this message which arise as a result of e-mail transmission. =
If verification is required, please request a hard-copy version.

MonkeeSage

12/3/2007 6:57:00 AM

0

On Dec 2, 9:21 pm, Giles Bowkett <gil...@gmail.com> wrote:
> > 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.bl...
> Blog:http://gilesbowkett.bl...
> Portfolio:http://www.gilesg...
> Tumblelog:http://giles....

I figured you would already know that, which is why I was confused.
Sorry about that. :) I've no idea about bash completion either.

Regards,
Jordan