Mighty Shell hate post

I wrote one simple script a long time ago that deletes all subdirectories with given names in the specified directory:

Remove-Item * -Force -Recurse -Include name1,name2,name3 -ErrorAction SilentlyContinue

Haven't used it in a while, but now I need it. I launch - I did not delete anything.

"WTF?" I think. Started digging. He fiddled, fiddled, went through everything, and previously created the list, and changed the names - it still does not delete anything. In the end, I read in their dock: "Actually, -Include is buggy when used with -Recurse, so use a hack.":

Because the Recurse parameter in Remove-Item has a known issue, the command in this example uses Get-ChildItem to get the desired files, and then uses the pipeline operator to pass them to Remove-Item.

Well, okay, rewrote using this crutch. One horse-radish - does not delete anything. Moreover, Get-ChildItem с -Include returns empty. Again, what I just didn’t do, as I just didn’t pervert with the parameters, doesn’t work. Most importantly, with -Exclude works, and -Include no way. I spent the whole day on this: I kept thinking that somewhere in the parameters I screwed up, that I didn’t take into account some tricky nuance. And what was the result? Put them PS7.1 - it worked. It even has the first tailless version using only remove-item earned. In general, it turned out to be their bug.

But having suffered with their Mighty Shell, I got into Google to read why their shell has such a furious syntax. Mlyn, they position it as .NET for the console, but they don’t even smell of C # syntax. Instead of him…

So, I came across this article:What I Hate About PowerShell". As the saying goes: "I couldn't agree more."

I suspect that the Mighty Shell team is a bunch of Bash fans.

- Let's finally make a console for Windows in which it will be possible to write complex scripts. And then our cmd is outdated, so much so that we are already a little ashamed.
- Let's! What will we do based on? We already have VBScript, JScript. Finally, we have languages ​​for .NET: C#, VB. Can we do it in C#? I mean, we'll use C# as the scripting language for our console. Moreover, we want to pull up .NET classes there.
— Nah, what are you, dude, what C#? Real geeks use bash! Here we are, let's make bash for Windows. I don't care that the syntax for bash was written, apparently, by a crowd of stoned hipsters in the distant 1960s. In general, the harder the better! Intuitiveness is for the weak! While writing a script in our language, the user must curse everything in the world and invent a couple of new curse words. Only such a language has the right to life. Look, Linuxoids live like this all their lives and get an inexplicable buzz from it all. And we are worse?

Only registered users can participate in the survey. Sign in, you are welcome.

Do you use PowerShell and are you comfortable with it?

  • 30,3%I do not use 40

  • 29,6%Tried it - didn't like it

  • 23,5%I use and I'm happy with everything

  • 12,9%I use it, but I'm not satisfied

  • 3,8%Hooray! I can finally use my favorite bash on Windows!5

132 users voted. 26 users abstained.

Source: habr.com

Add a comment