Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Well, "at least" is rather -- it would be perfect ;-) There is similar question -- Object-oriented shell for *nix . For me similarity with bash is no issue.

I would like to have some simple OOP plus LINQ. For now I am only aware of http://www.scsh.net/ but because of the syntax is a bit overkill.

Maybe I will show you by example what I mean:

run("ls ./").foreach(it => println(it.filesize))

or

run("find -r *.jpg") \
 .filter(it => it.datetime<today.adddays(-2)) \
 .foreach(it => run("gimp ${it.filename}"))

Is there anything closer to this "dream shell" than scsh?

Why am I asking? Because the more programs I write, the more I am drifting towards functional languages (C++ -> C#+LINQ -> Scala -?-> Clojure), and when yesterday I had to write simple find+print loop in bash it was painful. A man gets easily spoiled with all functional stuff ;-D.

share|improve this question
2  
I don't know of one, but you could probably cobble together an object-oriented shell with functional features in Python. The basics would probably take you half a day's work and about 300 lines of code, and you could expose the language to the user. Sadly, some of the syntactic elements of Python (I'm thinking of the whitespace) don't really lend themselves to this sort of thing. –  Alexios Jan 30 '12 at 13:05
1  
You could just use, say, Python or Ruby (your example looks Ruby-ish), for the find+print loop. (There also is rush but it seems kinda dead.) –  sr_ Jan 30 '12 at 13:33
    
@sr_, it was C#/Scala actually (well, kind of), thank you for the rush reference -- why didn't you post an answer instead of comment? Please do. –  greenoldman Jan 30 '12 at 14:18
add comment

1 Answer 1

up vote 4 down vote accepted

rush seems similar, e.g. allowing you to write

processes.filter(:cmdline => /mongrel_rails/).kill

or

myproj['**/*.rb'].search(/^\s*class/).lines.size

but it looks rather dead. In the end, I'd go with just using some scripting language for shell tasks (instead of the other way 'round), for example as explained in "Using Python to create UNIX command line tools".

(Edit there's also a object-oriented shell in active development, albeit differing a lot from rushs concept, oh.)

Edit2 Just stumbled upon pbs, a Python wrapper making the use of Python for shell-like tasks more direct.

share|improve this answer
    
Great! I will just keep your answer as not marked for a while longer, just to draw attention to the question ;-) I don't want to close the post too prematurely, I hope you don't mind. –  greenoldman Jan 30 '12 at 14:45
    
Sure, I'd be a little interested in more input on this issue, too. :) –  sr_ Jan 30 '12 at 15:00
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.