What's better: Bash or PowerShell?

What's better: Bash or PowerShell?

Attached: bash_or_ps.png (505x445, 7K)

Yes.

Yes?

Do the streams of objects instead of text streams make scripting in PowerShell easier?

They are waayyyy to different to make that call. I use both extensively. Powershell for work (sysadmin at a large public university) and bash for most of my daily computing needs.

In Powershell, almost everything is a .NET object. When you enter a command the output is not treated as a character stream/text. You work with and manipulate objects of data.
In bash, everything is usually treated as a character stream or text/textfiles. Bash commands are also less descriptive than Powershell's, but the linux man pages blow Microsofts docs out of the water.

All in all, they are both useful for different situations. I prefer bash over powershell anyday, but in the enterprise IT world, powershell is your best friend (unfortunately)

eh. I feel as tho im better at powershell scripting only becasue i get that $$$ for making scripts/programs so im more motivated. also i learned programming on OO languages, so powershell kinda resonates with that -_-

if your really savvy with regex and complicated redirection/pipes than bash is probably easier to script in

>Bash or PowerShell?
perl

5 or 6?

mksh

Nigger Powershell is godtier for Windows environments and Bash is godtier for Linux ones.

Difficult to say. Really just depends on whether you’re using GNU/Linux or Windows/NT

i really want to dive into powershell, i believe its a sleeper. Any resource you recommend?

But why do you prefer Bash? Isn't using something like "object.property" easier than trying to extract the data you need with regex?

I've seen some examples in PowerShell that look just like OOP code. Do these OOP requirements make PowerShell harder to write ad-hoc scripts in?

Why is Powershell more popular in the enterprise world? Is it just because of the MS market share or because of some kind of advaned PowerShell's .NET capabilities?

Aren't they both available for both platforms?

bash is more useful. In powershell you can pretty much only do what Microsoft lets you do and nothing else. Windows environment was not made with a shell heavy user in mind. Using the dot notation is nice sometimes but other times its awful. Working with pure text has a lot of advantages and is easier to pump something out on the fly imo

Bash is also A LOT more useful than powershell. I can go a full day only with a bash shell pulled up and nothing else, and still be productive/have fun. Not a chance in hell i can do that with powershell

Just learn by doing. Microsoft has some pretty good docs on their site. Do you work somewhere thats required to use powershell? Thats how I learned, and I always think its easiest to learn by solving real world problems. Honestly, i cant imagine ever learning powershell using just my personal Windows setup, its just not that useful.

Yes, but there are issues with using the opposite platform.

>bash
mkdir

>powershell
[system.io.directory]::CreateDirectory("C:\test")

$fso = new-object -ComObject scripting.filesystemobject

$fso.CreateFolder("C:\test1")

New-Item -Path c:\test3 -ItemType directory

powershell on linux is a joke, you cant get any of the AD,azure and SPO commands so its pretty much useless in most realworld allpications. And bash on windows is slow as shit compared to native linux

>implying mkdir isnt in powershell
nice try user, but microsoft already stole all the good bash commands

>5 or 6?
Underrated.

>Using the dot notation is nice sometimes but other times its awful. Working with pure text has a lot of advantages and is easier to pump something out on the fly imo
I understand the advantages of pure text, but I can't imagine what problems can come from adding the dot notation. Tosomeone like me, who has no experience in PowerShell, it seems like almost as much an improvement over hand-crafted regex as regex is over having to match strings with loops. That is, unless MS ruined the idea in some way.

>Bash is also A LOT more useful than powershell. I can go a full day only with a bash shell pulled up and nothing else, and still be productive/have fun. Not a chance in hell i can do that with powershell
I really like writing scripts for myself or some program prototypes in bash too. Too bad you can't use something like bash to write production code. My interest with PowerShell is that maybe it's more suitable for that because it sounds like it should be much faster.

Yes

>-_-
Shoot yourself

powershell is ass

mkdir is in cmd.exe

FYI, all CLI commands from cmd.exe are also available in PowerShell, except maybe the Linux version of PowerShell. Maybe.

fair
uwu

no

Maybe

What do you think about jq?

i don't know

I think the jews should be exterminated without a single genetic trace left on earth

>they created even uglier language than Java
if I would need to use shit like that I would rather write scripts in Java seriously, from 1.8 onwards it's palatable

I'm good at Bash. And that means I know exactly how terrible it is. 100% of unreviewed bash files I've dealt with that handle some kind of parameters have bugs with files with spaces in their names. This track record is stunningly abysmal. I've never met anyone else that knows exactly when you should quote variables.

I like Bash for interactive terminal use, but fuck using it for shell scripts. If you find yourself writing a shell script that's more than a dozen lines, just use python or go please.

fpbp

Powershell because i can use it to admin O365

All you proved is how flexible powershell is. You can use COM objects or WMI objects or even pull in assemblies from dot net to accomplish tasks.

Also, mkdir is aliased to New-Item so it’s not really that big of a deal.

Bash

>Powershell
OOP-based syntax shell so your inner indian feels at home

Powershell is garbage, just like everything else Windows has. Bash isn't great either but it's more usable.

BASH is fucking horrible if you need to work with other people.
At least I can read other people PS script and know what they mean. In BASH, I need to run every single command to know the what text output is then decrypt those regex.
Anyone who think BASH > PS is basement dweller or someone who never maintain other people script.

t. literal brainlet

if you don't know regular expressions you don't belong anywhere near a command line.

Sometime it easy like get the second column text, sometime it is the third text result which depend on the length of the next block size of text.
Sure, I can decrypt and modify it, but I better spend time to do other thing.

zsh

powershell is more powerful but bash is faster to actually do something

A billion times yes. That's it's primary advantage over bash though. I also like that it has a more standard syntax built in rather than, say, making brackets a separate executable. This has the benefit of not needing to remember "Do I put a space or not after this character? How do I get the shell to do basic arithmetic?"

The only real disadvantage Powershell has vs bash is that because everything is an object, its performance is absolutely terrible in comparison. Generally you shouldn't be writing performance-dependent code in scripts, so I don't think it's that big of a deal and would always choose Powershell.

>what's better, object streams or byte streams?
byte streams are much better, they are faster and more simple.
Powershell is definitely well designed. But it is the lipstick on the pig that is bloated .NET classes known as the Windows ecosystem

Can you repeat the question?

thats just high tier.
god tier is zsh with oh-my-zsh plugins and powerline.

What's a good resource to learn bash?

definately powershell. Bash is an awful language that its own creator admits he didn't know any better when he wrote it.

Just a shame so much has been written with it

ABS guide.

But I'd recommend trying to do some simple commands with sed and grep first to get the idea.

>The only real disadvantage Powershell has vs bash is that because everything is an object, its performance is absolutely terrible in comparison.
I'm afraid I find it hard to believe. Shouldn't binary objects work faster than strings?

>Generally you shouldn't be writing performance-dependent code in scripts, so I don't think it's that big of a deal and would always choose Powershell.
Can there be a shell with really good performance? Like those of Python and Perl. Or even optionally compileable like Python?

Attached: 99.jpg (320x240, 9K)

>not using bat files
>implying powershell can do anything useful
Windows has no command line, lol

Zsh

Why would you use powershell on Linux?

I used to be a fan, then I discovered that bytes are the only type you need.
My real complaint is that there's no way to interface with the object pipeline outside of Cmdlets.

>there's no way to interface with the object pipeline outside of Cmdlets.
Explain

No external program can generate or accept objects from the PowerShell object pipeline unless you wrap it in a Cmdlet or rewrite it as a Cmdlet.

What's so good about zsh?

powerbash

XD

fish /thread

You joke, but Powershell is *actual* OOP and not the cut down Javashit.

what the fuck is this shit?

Attached: cI4pEE[1].png (643x781, 17K)

aliases

The inventor of PowerShell literally says that he doesn't care what people use, just that they get work done.

PowerShell is a great frontend for .NET, WMI, COM and other Windows APIs. It works with objects in a object world (on Windows, that is).
It's focus is on people with jobs. Sorry NEETs, but the appeal of quickly querying BIOS versions on 2000 machines is lost on you.
It has a decent remoting protocol. Fitted for the job, but cumbersome compared to good old SSH.

PowerShell was made to do what Bash couldn't, which was to work with existing Windows APIs. Bash didn't work there.
Likewise, PowerShell on Linux makes no sense if you're not already used to it on Windows. It has less than zero appeal to Linux users and beginners without Windows jobs.

It's tab-completed. Nobody actually types that shit.
Such is the life of a bolt-on feature, running external programs that is. It could typecast the object to a string, but it might confuse beginners more than it helps those who know what they're doing.
And those who know what they're doing are making Advanced Funtions with cmdletbinding and Begin, Process and End blocks anyway. I wouldn't trust an automatic type casted object to be what I wanted.

Powershell because it has objects. In bash, every program just takes strings and outputs strings and all of them output and take strings in different orders and between every program, you need to re-parse and change the strings again and again.
Also it's the reason UNIX-Programs can never change their output because then all scripts that rely on its output to be separated a certain way and everything to be at a certain column would break, so instead you need to pass 7 flags in order to make the output useful.
And don't even think about hierarchical data structures on Unix shells.

YOU'RE NOT THE BOSS OF ME NOW

The authors of PowerShell also thought of making an alias for curl while having almost no similarities to the original curl command. Do you think I should trust them to not fuck up like that again?

>It's focus is on people with jobs. Sorry NEETs, but the appeal of quickly querying BIOS versions on 2000 machines is lost on you.
wow great argument fagtron you sure convinced me with those hot opinions

i dunno, if enough people keep saying its good, it must be true!

muh enterprise syntax
muh objects
muh job security

Attached: muhps.png (771x634, 20K)

AND YOURE NOT SO BIG

>The authors of PowerShell also thought of making an alias for curl while having almost no similarities to the original curl command. Do you think I should trust them to not fuck up like that again?
And they did it to please faggots like you who would literally otherwise google 'curl powershell' because iwr is apparently too difficult to remember.

>wow great argument fagtron you sure convinced me with those hot opinions
And that owned me how? You just admitted that you don't have a job.

du is just a wrapper for ls in your example, and in the PowerShell example, they're making the wrapper by hand with dir

It's also currynigger level code that would make any PowerShell aware employer giggle. Like why even assign $f, and why do Select-Object, to make it say 'Name' instead of 'FullName'? And why the mix between aliases and full cmdlet names?
WHY ARE YOU ASSIGNING $dir = "." WHEN THE DEFAULT PARAMETER IS ALWAYS THE CURRENT DIRECTORY


PowerShell doesn't have this cherry-picked example built in, oh how I am doomed. I got beaten by someone who writes shitty code, how will I ever recover!

>And they did it to please faggots like you who would literally otherwise google 'curl powershell' because iwr is apparently too difficult to remember.
They don't have to please me specifically or anyone in this thread. That's a fuckup that probably happened in a whiteboard meeting and everyone thought it was OK. I can't trust a team that was capable of making such decision, therefore I'm not interested in Powershell.

>And that owned me how? You just admitted that you don't have a job.
You, picture related. Why are you so butthurt?
By the way, I work at a small local ISP, managing some linux servers, but I guess that's not enterprise enough for you. You aren't making a good job trying to shill your shell attempt...

>It's also currynigger level code
Isn't Microsoft mostly curry level code?

>PowerShell aware employer
kek

Attached: no u.jpg (640x454, 31K)

>They don't have to please me specifically or anyone in this thread. That's a fuckup that probably happened in a whiteboard meeting and everyone thought it was OK.
And it was a good idea for everyone but curl.exe users, the curl port for Windows. And count the amount of PowerShell beginners vs the amount of curl.exe users, and you've got a clear win for curl as an alias.

>I work at a small local ISP, managing some linux servers
Nice, that's great. That's a scenario where PowerShell absolutely sucks.
Don't get me wrong, I'm not butthurt. You're a Linux guy working with a small amount of Linux servers, why would you ever touch PowerShell, that makes total sense, and what I've said all along. Here's my cents from my first reply here :
>It has less than zero appeal to Linux users and beginners without Windows jobs.
What doesn't make sense is that you act like curl being an alias is a total turnoff, or whatever small thing.
You like the text stream better, or you don't like the verbosity, those would be reasons I could get behind.

I don't work in enterprise either, we're only 300, and that's small in Microsoftland. But we work with AD, SCCM and Windows PC. It's either GUI or PowerShell, and I despise GUI.

>In Powershell, almost everything is a .NET object. When you enter a command the output is not treated as a character stream/text. You work with and manipulate objects of data.
this is why it sucks, because you can't write a utility that outputs a useful formatted stream of text

>Too bad you can't use something like bash to write production code.
but you can use ash

and how are you supposed to hack with binary objects? you're sacrificing usability for negligible performance gains

>ha, i named another shell, i can contribute to this conversation! I am smart :^D

Isn't ash just truncated bash?

Bash can't even do this, lol.

Attached: power_shell_1.png (239x96, 2K)

Well, my idea is that you'd have the advantages of both binary interface for the speed, and that of having the input data already parsed into objects for usability. What can possibly go wrong?

Unironically PowerShell.
Objects > Streams.

Attached: 1483190084927.jpg (526x482, 27K)

different user, but to be completely honest after bash failed me on windows I turned to powershell for a simple script that'd take ~1500 photos of our client's website and rescale them in ifranview (via cmd) and put them in the correct folder and it was super easy
surprisingly so, actually

I used to think powershell was a fucking meme but I like how it's just like an objective programming language but as a script

like python, without the retarded line formatting requirements

lol

PowerShell is slower in general because it's built on .NET, so take that guys performance talk with a grain of salt.

>and how are you supposed to hack with binary objects?
You edit the property you want to work with? I'm not sure what "hack" refers to here. I'm guessing sed, awk. But the problem is that the tools and practices are so different between the languages, so I'm not sure how to make a good example.

>I'm afraid I find it hard to believe. Shouldn't binary objects work faster than strings?

Attached: brainletcastle.jpg (645x1000, 107K)

Imagine being that misinformed

>zsh
>>oh-my-zsh
>>>powerline
you are the embodiment of nu-male gnu users. Do you use arch, btw?

>pass an int into a pipe -> read an int into a variable
>vs
>convert an int to string -> pass the string into a pipe -> read the string -> grab the number as a string with regex -> convert the number from string to int -> assign that int to avariable
What am I missing here?

>Cmdlet
Why is PS roasting it's users?

yeah that makes a lot of sense. But i'm smelling the $$$ and i just want to whore out and apply for a job that utilizes it. Their docs looks like a great start ofc, ty.

tcl

>bash-it
>gbt

What can zsh do that bash can't?
If anything this is the right answer but having to learn another scripting language is annoying

Reminder that you haven't made any valid arguments except for muh job needs it and how confusing terminology for programs without feature parity is okay because get used to it
Nevermind, you haven't made any arguments.

t. pajeet

oh no no no

Attached: screenshot-com.termux.jpg (482x286, 12K)

Can you make program prototypes with PowerShell? Can you gui?

>muh job
I think you're missing the point.. Dude, you're looking at a Microsoft product, of course it's focus is on muh job.
It was literally made to admin Windows. Now, 10 years after version 2 the motto is 'manage any device and any cloud from any device'. It's 90% admin focused, 9% developer focused and 1% hobby focused.
I'm not sure what to tell you at this point.

>confusing terminology for programs without feature parity is okay because get used to it
That's one perspective. The other is 'oh cool curl is just curl'.
Regardless, PowerShell went open source and one of the very first issues was to remove curl as an alias, submitted by the maintainer of curl. Almost killed the entire repo, because do you break people's code, or can you handle the wrath of a thousand butthurt autists?
Since it's crossplat and open source, mistakes like that won't happen again.

>Nevermind, you haven't made any arguments.
Now you're just being stubborn because Jow Forums. Cmon buddy.

>prototypes
It's a fully-featured OOP with a TDD framework, so yes.
>gui
Kind of. You load the dlls for the framework you want.
It's too slow for production backend code, but it works fine for end user stuff.