Ruby shell instead of Bash shell in Ubuntu?

7

2

It seems to me that Ruby is far more powerful, and you can also do more powerful scripting with it.

Are there any open source implementations out there that could replace Bash with Ruby on Ubuntu, so that you can use Ruby instead of Bash commands.

Like a Ruby shell instead the Bash shell.

ajsie

Posted 2010-08-28T11:42:32.300

Reputation: 1 675

1how are you going to do ls? – hasen – 2010-08-28T11:50:59.023

1A question for superuser.com? – Merlyn Morgan-Graham – 2010-08-28T12:03:11.530

@hassen: thats why im looking to a shell-specific ruby implementation. Maybe they have their own methods. But in this case, i can combine things better if it's all the same language. – ajsie – 2010-08-28T12:14:30.050

@hasen in irb: Dir.entries('.') :) – Ziggy – 2012-07-31T05:41:40.837

Answers

9

You may look on this project: https://github.com/adamwiggins/rush

Nakilon

Posted 2010-08-28T11:42:32.300

Reputation: 843

That is exactly what i mean. – ajsie – 2010-08-28T12:16:31.920

It isn't though: @ajsie, how are you liking rush? I tried it and found it unusable. On the other hand, just using irb seems like (with a bit of tweaking) it might actually work. – Ziggy – 2012-07-31T05:42:39.433

1

You wouldn't want to do that. It would mean, for example, putting all arguments passed on to programs in double quotes. (ipython, which resembles ruby's irb, can do something like this, but it's cumbersome) Although I agree that bash and co are not great, they can't just be replaced, as an interactive prompt at least, by a general-purpose programming language.

loevborg

Posted 2010-08-28T11:42:32.300

Reputation: 151

Yes they can...its just a matter of time :) Look at my comment above. – ajsie – 2010-08-29T03:20:00.510

0

I've seen some attempts, but it's not something that's all that useful. If you want to do something in Ruby, you can just fire up IRB. Rarely, I do this to iterate over some files and rename them in some non-trivial way or something.

As for scripting, well, just write Ruby scripts.

AboutRuby

Posted 2010-08-28T11:42:32.300

Reputation:

I really hope in the future ruby can replace bash and more corporates are embracing this. I want to cut out bash entirely. – ajsie – 2010-08-28T14:38:49.253

Bash is esoteric, quirky and generally a pain to write scripts with. I've written some large, non-trival programs in Bash. I never want to do that again. However, I have no problem using Bash on the command line. Even some basic loops and such aren't hard. But no one is forcing you to write your scripts in Bash, so do we really need an under-maintaned, DSL-heavy Ruby shell? – None – 2010-08-28T19:49:48.940

@AboutRuby. If Ruby was de-facto shell for Linux, then yes, it would be more lovely to use. Cause you can see what it returns. You can inspect the return object, see what class it is, what superclass it has, you can see what methods it contains etc. You are already using ruby to script, you can use it for web applications, for your Mac (rb-appsrcript). Bash is outdated and so yesterday of doing stuff. If you could choose between ruby and bash shell when you install ruby, then it would be great, not having to implement ruby on top of bash, but having ruby classes to communicate with linux. – ajsie – 2010-08-29T03:17:14.183

2Bash is just a toolbox with a bunch of tools they threw inside, not following the same pattern and so on. Just like PHP. Yes, everyone is using it today, but that doesn't mean that we actually like it. – ajsie – 2010-08-29T03:19:15.113