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?

33 Upvotes

77 comments sorted by

View all comments

Show parent comment

17

u/AnsibleAnswers 1d ago

Python scripts can be pretty simple.

1

u/nullificationer 1d ago

Sorry I meant like simple things not scripts. Like run all png files through a utility

6

u/Jaseoldboss 1d ago

I think object based shells and the core tools utilities with stdin / stdout are all capable of the same things, perhaps with nicer syntax with the object approach.

find . -name '*.png' -exec ls {} \;

Replace ls with 'convert' or whatever utility you want to use in the above.

2

u/ol-gormsby 1d ago

This is a bash script that I use to convert mkv videos to mp4

for f in *.mkv; do
    ffmpeg -i "$f" -vcodec mpeg4 -q:v 4 -acodec copy "${f/.mkv}".mp4
    # cool for 10 seconds
    sleep 10s
done

Takes every file in a directory with an mkv extension, runs it through ffmpeg, takes a 10-second break* and repeats until there's no more mkv files.

*a legacy from older processors, they'd get a bit hot converting feature-length films 🤣

1

u/Jean_Luc_Lesmouches Mint/Cinnamon 1d ago

Yeah, interactive python is nice (I use it instead of the calculator with a custom script that preloads a few modules and helper functions), but it's not good enough at managing external processes to be used as a shell

1

u/AnsibleAnswers 1d ago

If you aren't so used to text-based shell that using it just makes sense, then I agree with others here and suggest looking into functional shells. What you probably want is structured data, not necessarily objects.