This looks kind of like Powershell, which I've been in awe of for several months now. But being built on a more dynamic runtime this will have the ability to use to extend objects that you get back from the shell so it could be even better.
Powershell is pretty cool, but its syntax takes a little getting used to. I keep wondering why they chose to create a new syntactic paradigm when they are already so many around...
I agree with this. It's a hugely impressive product, but the syntax is rather off-putting. I also feel that the default settings it installs with aren't too great because you can't run scripts in files without changing the environment -- the security angle makes sense, but it makes what's already a hard sell in the Microsoft world (a new shell) even tougher.
ya, i think the significance of rubish (to myself anyway) isn't so much interactivity (it's plausible, but not convincing), but this potential to abstract my personal usage pattern in Ruby.
First: Thanks! I've been meaning to do exactly this once I had even a spare moment (consider yourself forked! ;-)...
Second: I think where this will really shine is in the "twilight zone" of shell scripting. So often, I start off with a short chain of commands on the command prompt. I'll keep adding to the chain, until at some point I feel the need to move this elaborate chain (usually an alias at that point) into it's own script file. I could copy directly, but then any improvements would require continuing to use shell script (ugh). On the other hand, I could translate the existing script to Ruby, but then I'd have to put in the overhead to do the translation with no immediate gain.
With this, I could see doing a direct copy-->paste from command line to script file and just keep going...or better yet, since it's all Ruby, why not an extension on File to automatically write out X lines of history to a script file?
Bash is a decent command line shell, but it sure makes a lousy attempt to be a programming language. I wouldn't mind so much except that because of this, people keep creating big ugly bash scripts and I have to keep opening them up and reading them.
I've seen a ton of useless Ruby shells, and while this one looks much better, I think it's still going at it the wrong way. You should start by trying to replace irb, not bash.
IPython worked it's way into my workflow because I wanted a richer "real language" REPL, and now I end up using its shell capabilities sometimes. If I had started out trying to use it as a shell it would have failed at that miserably, even though it's the best implementation I know of.
I find it hard to believe that with all the development going on in the ruby world, there still isn't something comparable to IPython. To be honest, IPython is one of the reasons I use python over ruby. It's just a great way to interact with the language and my code.
It seems the ruby world is getting alot of press these days. Deservedly so, but taking a look at the kind of mind share they have in community it will only be a matter of time until they come with something like iPython.
Today, IPython has a lot of features, but I only use a small subset of them on a daily basis (namely their shell interface). I would think that a decent ruby hacker could throw something similar together in a weekend, put it online and have a decently stable version in a month or so.
I was going this direction a month or two ago. I was in one of the (Windows) CS labs in school, and was annoyed at the monstrosity that is cmd.exe. I noticed that, because the school had a full dump of Cygwin installed on one of the network servers, I had Ruby available (up until that point, I'm guessing the executable had never even been run before.) So, I started writing a shell; I called it Plush (the logo was going to be a stuffed animal of some sort).
At first, I just wanted a self-contained, cross-platform ruby shell, that I could pop open from any computer without having to (or being able to) install anything (with rubyscript2exe in case there was no Ruby around.)
Then, I started adding all sorts of neat convenience methods. I sort of wanted to imitate Powershell, but then I started wanting even more. Basically, I was going to implement a version of Plan 9, but with an Object system instead of a filesystem. I wrote up a user story that went like this:
~$ self
=> #<Home @user=#<User ...>>
~$ x = "hello"
=> "hello"
~$ ls
=> x
~$ cd x
~/x$ ls
class -> /lib/String
methods/
~/x$ cd methods
~/x/methods$ ls
capitalize
chomp
downcase
[etc]
~/x/methods$ ./capitalize
=> "Hello"
~/x/methods$ cd capitalize; ls class
class -> /lib/Method
~/x/methods/capitalize$ cd !; ls
class -> /lib/String
methods/
~/x/methods/capitalize/!$ inspect # ./methods is first in /etc/path
=> "Hello"
It got even more complex from there, where entering an executor (a !/ directory) of a method with parameters would put you in a closure, that you had to then curry by putting new objects into each successive directory... I sort of gave up when I saw how obtuse the syntax was. It was sort of like LISP, but with paths instead of linked lists. :)
Back in college I used a scripting language I developed (on my own time, had an interest in it) as a shell (which I turned in as a class project for Unix Systems Programming). Unix commands (the actual command, not the output) could be stored in variables, they could be combined (via a pipe; I'm checking the source right now, and while I only piped STDOUT, adding a pipe for STDERR would be trivial) and redirection of STDIN, STDOUT and STDERR was supported.
And 15 years later, I still don't use it.
The shell really is easier to use on a daily basis than most scripting languages (and yes, this does include Perl). Yes, I could type 'ls <enter>' and get a directory listing. But what about of a different directory? In a shell, it's 'ls /tmp' (for example). I want to see if a particular email got delivered? 'grep 70333248A03 /var/log/mail.log'.
Unless the scripting language makes it this trivial to issue simple commands, you probably won't be using it as a shell for very long.
16 comments
[ 3.7 ms ] story [ 53.9 ms ] threadabstraction is a form of memory.
Second: I think where this will really shine is in the "twilight zone" of shell scripting. So often, I start off with a short chain of commands on the command prompt. I'll keep adding to the chain, until at some point I feel the need to move this elaborate chain (usually an alias at that point) into it's own script file. I could copy directly, but then any improvements would require continuing to use shell script (ugh). On the other hand, I could translate the existing script to Ruby, but then I'd have to put in the overhead to do the translation with no immediate gain.
With this, I could see doing a direct copy-->paste from command line to script file and just keep going...or better yet, since it's all Ruby, why not an extension on File to automatically write out X lines of history to a script file?
...oooooh! I'm excited already!
This seems like fun anyway. Operator overloading could go a long way in providing a bash-like syntax, while still providing Ruby-like extensibility.
IPython worked it's way into my workflow because I wanted a richer "real language" REPL, and now I end up using its shell capabilities sometimes. If I had started out trying to use it as a shell it would have failed at that miserably, even though it's the best implementation I know of.
At first, I just wanted a self-contained, cross-platform ruby shell, that I could pop open from any computer without having to (or being able to) install anything (with rubyscript2exe in case there was no Ruby around.)
Then, I started adding all sorts of neat convenience methods. I sort of wanted to imitate Powershell, but then I started wanting even more. Basically, I was going to implement a version of Plan 9, but with an Object system instead of a filesystem. I wrote up a user story that went like this:
It got even more complex from there, where entering an executor (a !/ directory) of a method with parameters would put you in a closure, that you had to then curry by putting new objects into each successive directory... I sort of gave up when I saw how obtuse the syntax was. It was sort of like LISP, but with paths instead of linked lists. :)This one (Rubish) looks a bit half baked, but I'll have to look into it some more.
And 15 years later, I still don't use it.
The shell really is easier to use on a daily basis than most scripting languages (and yes, this does include Perl). Yes, I could type 'ls <enter>' and get a directory listing. But what about of a different directory? In a shell, it's 'ls /tmp' (for example). I want to see if a particular email got delivered? 'grep 70333248A03 /var/log/mail.log'.
Unless the scripting language makes it this trivial to issue simple commands, you probably won't be using it as a shell for very long.