Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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


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
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
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
up vote 5 down vote accepted

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

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



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

You'd have to write your own objects for the LINQ stuff, but expanding bash to OOP is pretty easy. Check out https://github.com/uudruid74/bashTheObjects

share|improve this answer

Your Answer


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.