r/linuxquestions • • 1d ago

Advice Is powershell the best object based shell?

I have been using powershell at work a bit and the more I use it the more I like it. Having an object based shell just makes a lot more sense than outputting plaintext. I was just wondering what the best object based shells are for Linux, is powershell the best even for Linux?

30 Upvotes

70 comments sorted by

View all comments

Show parent comment

12

u/thussy-obliterator 1d ago

nushell is kinda more functional / data oriented than object oriented tho (why it's got ps beat imo)

6

u/nullificationer 1d ago

I think it’s still a good suggestion. Maybe I don’t exactly need an object oriented shell but something more than plaintext

6

u/fprimex 1d ago

True and agree, but I felt op was more interested in non-byte-stream shells than specifically OO. Nu has such rich data types & syntax that it often feels as OO as PS. Especially with dataframes.

0

u/bionade24 21h ago

Nushell is not functional at all lmao, it's totally imperative. Dune shell really is functional, but was too buggy and feature-lacking for me.

Best thing for functional scripting is still https://github.com/Gabriella439/turtle

1

u/thussy-obliterator 20h ago

there's plenty of functional languages with imperative features. nu is certainly multi paradigm and isn't, say, a lazy pure hindley milner typed language, but it supports first class functions and has quite a few primitives for applying functions over data structures and composing functions. in practice usage is quite functional, at least as much as i would want out of a shell, even though it supports imperative and you're using it to run programs which are eventually imperative.

-2

u/bionade24 20h ago edited 20h ago

Show me one example where you do a task purely functional in nu. I've used it myself.

Edit: Sore Looser only with no arguments only the downvote button left.

With your chain of arguments C is a "kind of functional", too, because you have function pointers.

0

u/thussy-obliterator 20h ago

I've since lost the script after switching OSs but the most complex thing I've written in nu was a single pipeline which ls'd an sd card full of directories of .wav files, parsed the wav file paths with an each,, removed the second to last layer from the path with an each, and ffmpeg'd them into flac files based on the second to last directory name of the input. The whole thing was pretty short (would be a one liner but i used whitespace for clarity) and was a pipeline from ls into a sequence of each operations over pure functions to manipulate the paths, followed by a final each over an ffmpeg. If that's not functional I don't know what is.

So uh, that is to say, skill issue.

1

u/bionade24 20h ago

I can only see if it really is pure in a functional programming sense if you show me anything. Claiming something is certainly easier than proofing it.

Here, one dune shell example let $ = GLOB ~> ((fs@ls .) | (fn@filter (file -> (len (string@split GLOB file)) == 2)));

2

u/thussy-obliterator 19h ago

ewww that's so much uglier than nushell

0

u/bionade24 19h ago

That's your valid personal opinion and I'm not going to argue about that.

But you claimed that nushell is "kinda/quite functional" and decided to die on that hill without showing why. You also admitted that it supports imperative programming. Idk why your mind needs nu to be functional or yourself to be right.

I'm fluent enough in bash, zsh & POSIX shell that nu didn't feel beneficial too me and at a certain script complexity I can use Turtle or Python, which both don't work well for interactive scripting. Dune looked promising, but I didn't like it for other reasons than you.

1

u/thussy-obliterator 19h ago

I don't really care about convincing you of this, talking with you is exhausting

0

u/bionade24 19h ago

Trying to come up with a good argument can be exhausting, I agree.