Ruby and the shell!
After a couple of futile attempts to create my own shell using Ruby for a very good reason for the last 4 years, I guess I'm back at it again, this time with some promising hope. Back in 2001, I wanted to create a shell to replace Bash, but being extensible using ruby script. I did get a little far emulating the basic command line interface as in bash (or other sh-compatible shell), and then wondered - what would I have gained by this exercise... it was like re-inventing the wheel using plastic instead of rubber
The desire for creating a ruby shell has remained since then, with constant attempts to come up with an enlightening idea to make it worth the effort. Recently, when I interacted with supposedly AI bots on IRC (Alice, Eliza kind), I pondered about creating a shell that actually interacts with us using natural language ? Oh well... not *exactly* natural language in a purist sense, but a shell with basic pattern recognition system on commands sent to it using simple English (or other natural language) and to determine what the user expects the shell to perform based on relevant keywords extracted from the input command sequence (which of course is a simple english sentence or phrase).
Added to it, the shell should have some basic "programmable and extensible" intelligence in answering various queries asked by the user. An example session would be as follows:
USER> What is the time right now ?
SHELL> The time now is 10:46 pm (IST)
USER> Define life
SHELL> From Webster's Revised Unabridged Dictionary (1913) [web1913]:
Life \Life\ (l[imac]f), n.; pl. {Lives} (l[imac]vz). [AS. l[imac]f; akin to D. lijf body, G. leib body, MHG. l[imac]p life, body, OHG. l[imac]b life, Icel. l[imac]f, life, body,
Sw. lif, Dan. liv, and E. live, v. [root]119. See {Live}, and cf. {Alive}.]
1. The state of being which begins with generation, birth, or
germination, and ends with death; also, the time during
which this state continues; that state of an animal or
plant in which all or any of its organs are capable of
performing all or any of their functions; -- used of all
animal and vegetable organisms.
USER> What is 4 + (5 * 2) ?
SHELL> 14.
USER> Show me the contents of my music folder.
SHELL> Your music folder has 3 music files. They are as listed below:
1. Mr. Tinker Train by Ozzy Osbourne (file is of MP3 format).
2. Iron Man by Black Sabbath (file is of OGG format).
3. Man on the Silver mountain by Blackmore's Rainbow (file is of OGG format).
USER> Play everything from my music folder.
SHELL> Playing "Mr. Tinker Train by Ozzy Osbourne" - duration: 5 minutes, 39 seconds.
USER> Delete all files created yesterday between 2:00 pm to 4:30 pm
SHELL> There are 4 files to be deleted based on the above mentioned criteria. Do you wish to see them ?
USER> No, just delete them.
SHELL> 4 files deleted (activity being logged for future reference).
USER> When did Xeno last login ?
SHELL> Xeno logged 5 hours ago, he is currently active.
Phew... this seems a bit too ambitious. Hmmm, if I could succeed in getting done anywhere close to what I imagine, this could be a killer app ;-).
Perhaps I must sit and think more about it now, and get an overall idea of where to start...