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

I've always found it awkward when complex shell commands involve parsing text output with AWK. Basically we're converting structured data into text, then parsing the text again to get back at the structured data.

PowerShell is a Windows shell which avoids that problem by allowing you to pipe typed objects between shell commands instead of just text.

Are there any Unix shells which are object-based instead of text-based, like PowerShell?

share|improve this question

No, it is the other way around. There is no spoon^H^H^Hstructured data. There is only text.

A big part of the Unix philosophy is based on the idea of outputting text and accepting text as input. You might want to consider reading "The Art of Unix Programming", which has a nice explanation about this.

Don't get me wrong: I understand your point and I know what you are trying to get at. There are things like the interactive interpreters of Ruby and Python, which can be used as a shell, but they are not as friendly for basic tasks as Bash is. Try and change directory, for example.

Also, using objects in a shell is not all-that. If only your shell supports this, on Unix, you would be at a loss. All the standard Unix text manipulation tools would have to be altered, like grep, awk, sed, etc.

I think there has been an attempt to create something like this a few years back, but I can't remember the name and I haven't heard about it in a long time. It's probably not going to take off.

share|improve this answer
Interestingly, replacing text streams (or actually, byte streams) by data object streams would not go against the general principles formulated in the book. It even seems to play better with the "rule of representation". It's just that unix has chosen text streams as the interface between programs. – Wim Coenen Aug 12 '10 at 13:32
But by 'data object' do you mean an actual Python / Ruby / C++ object or something like a C struct? – wzzrd Aug 12 '10 at 14:04
By data object I mean a collection of name value pairs, where the values can be of some primitive type, another data object, or a list of data objects . Come to think of it, the JSON format could work to implement this on top of text streams, so it's not incompatible with "the unix way". The shell could present output in a friendlier format to the user when it detects JSON. But like you said, tool support would be needed. – Wim Coenen Aug 12 '10 at 14:29
+1 "Do not try to bend the spoon, that's impossible. Instead only try to realize the truth... there is no spoon." It's not so much text-as-an-interface, but streams of data as an interface. Objects are nice for programming, but sometimes they become a little tiny prison to put your mind into... – Avery Payne Aug 12 '10 at 17:16
zsh > bash. My opinion but really if you haven't tried zsh you should – xenoterracide Aug 12 '10 at 22:19

There's actually a project called Pash that aims to implement PowerShell (on top of Mono), but it seems to have stalled.

share|improve this answer
unix hackers spend time on microsoft-based projects = that's the ant and the grasshopper all over again – ixtmixilix Oct 14 '10 at 0:00
We're back from the dead: github.com/JayBazuzi/Pash, twitter.com/PashProject – Jay Bazuzi Apr 8 '13 at 23:41

There is project, whose goal share similarity with PowerShell: Hotwire. It combines regular sh with python scripting and window/graphical environment. You could give it a look.

It's based around object-oriented pipeline that you can extend with your own objects by wrapping existing programs or using Python libraries.

share|improve this answer
That's the project I was trying to remember the name off! Last commit in trunk: two years ago... – wzzrd Aug 12 '10 at 14:03

I would think you could accomplish most of that by writing a bunch of interpreted (or compiled) scripts, then invoking them within the interpreter's shell, which will return or preserve your objects and so on if you want.

You can do this in at least Ruby, Perl, Python, Haskell (e.g., GHCi), JavaScript (e.g., node.js), Matlab, and certainly other languages...

share|improve this answer

Another thought three years later: It's possible to represent an object with a text stream using either XML or JSON. I prefer JSON (simpler), and, indeed there are projects out there to give the classic *NIX utilities JSON support. For example: https://github.com/step-/JSON.awk

One issue with using an object-type model for classic *NIX programs like AWK is that they really do not have OO support. For example, while AWK does have associative arrays, the arrays are not multi-dimensional (each element in an AWK array has to be a number or a string; an array is not allowed to be an array object in AWK).

share|improve this answer
Clojure offers edn which allows all sorts of typed data to be serialized/deserialized while JSON is limited. – Mario Dec 19 '14 at 16:40

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.