5 ms·
I started using Linux in 1997. I've been working at Microsoft for a little over 4 years. There are some annoying things about Powershell (verbosity and slow loa
by locusofself 2y ago
I started using Linux in 1997. I've been working at Microsoft for a little over 4 years. There are some annoying things about Powershell (verbosity and slow loading of tab completions etc), but in some ways it's vastly superior to bash, as it deals with structured data and not just strings you have to parse, and it has an extremely powerful standard library API (.NET) at your fingertips.
I still love bash and use it as well. But the hate powershell often gets is misguided.
- irunmyownemail 2y agoBash rocks because it is about the user and the OS. Powershell is about one thing, Microsoft and the ugliness of ItS CumBerSomE-SynTaX Du-Jour is proof.
- psd1 2y agoBash is about the user? Are you serious? It's about what twenty people could sling together and make work on a Vax in the 80s in 4Kb. Powershell has regular syntax, legibility, a high degree of discoverability, and included batteries for things that bash victims reimplement again and again. It may not be the best shell for your purposes - it certainly won't run in 4Kb - but it wipes the floor with all legacy shells for usability. You're welcome to have an aesthetic opinion on the syntax, but you must be dead inside if you can look at an average bash script and not recoil in horror. Argument parsing? sed? Control statements? Quoting and escaping? "It's all about the user" is it fuck, you're on drugs.
- lnxg33k1 2y agoI feel it's nice to have the power of choice, I can deal with structured data in bash as much as I need, whenever I need, with awk, but it isn't there when I don't
- airtonix 2y ago[dead]
- skinner927 2y agoThere was a time in Powershell’s life when stdout redirection to a file (>) would write UTF-16, then that changed to UTF-8 with BOM and now it’s UTF-8 no BOM. During those times some PS versions would allow to change this globally, some would not. Even if you could change it globally, the names for the same encodings have changed. PowerShell 5.1 “UTF8” actually meant “UTF-8 with BOM” PowerShell 7 “UTF8” meant no BOM. If you read a file in PowerShell that does not have a BOM it decodes it as ANSI. Yes, ANSI, not Ascii. Which is a hilarious choice because you can’t even write an ANSI file in PowerShell. The closest encoding you can use is “Default” which will use the system default but your systems default might not be ANSI. PowerShell is a hot mess. Go read the official docs for character encoding[1] if you don’t believe me. I have CI scripts that have to use .NET calls[2] in PowerShell to write ssh keys to disk because it’s impossible to write utf-8 no BOM (or ascii) with out carriage returns (\r) being inserted before every new line (\n) even when the incoming string didn’t have them. File encoding is just ONE of the reasons I hate PowerShell and why it’s so obviously clear people who were not qualified to design a shell, designed a shell. [1] https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_character_encoding?view=powershell-7.4 https://learn.microsoft.com/en-us/powershell/module/microsof... [2] https://stackoverflow.com/questions/5596982/using-powershell-to-write-a-file-in-utf-8-without-the-bom https://stackoverflow.com/questions/5596982/using-powershell...
- beart 2y agoIt's also worth pointing out that those Microsoft docs differentiate between the two major versions of powershell using the names "Windows Powershell" and "Powershell".
- delusional 2y agoI also enjoy how the online manual pages doesn't even try to tell me which version it's about. It's all just powershell https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/invoke-webrequest?view=powershell-7.4 https://learn.microsoft.com/en-us/powershell/module/microsof...
- 2y ago
- Yodel0914 2y agoI've used powershell a bit, particularly for scripting CI pipeline steps. No matter how much I use it, I can never remember anything about the syntax. I primarily use C#, so you'd think there'd be some affinity, but nope. It's like a black hole. I've written in a lot of different languages in my time and never had this issue with anything else. It's weird.
- rewgs 2y agoExact same here. I write roughly the same amount of Powershell as I do Bash, and yet to this day I feel like I barely know Powershell and constantly look up the simplest things, whereas loads of dark corners in Bash stick in my mind perfectly fine.
- Fire-Dragon-DoL 2y agoTo be fair, I have a similar problem with bash. There is no way to remember how to write a for loop for me
- shortrounddev2 2y agoYeah bash has some of the worst syntax of any language I've used. Why do if statements have a semicolon in the middle of them?? Why does it use `[[` and `]]`? why does `if` end with `fi ` but `while` ends with `done` ? people who rip on powershell but prefer bash make no sense to me at all
- delta_p_delta_x 2y ago> people who rip on powershell but prefer bash make no sense to me at all They're used to it, that's all. Just like how people used to US Customary find SI units weird and confusing.
- devnullbrain 2y agoCan Powershell tee a background task yet?
- psd1 2y agoI may be misunderstanding, but you can write to the console host in a background task. To get an output stream, you need to await the task and collect the result.
- cassepipe 2y agoNushell is plenty fast, works with structured data (also has a vi mode if you care, I do) and works equally well on Windows and Linux. You can install it with winget on windows and with cargo or the system's package manager on linux. https://www.nushell.sh/ https://www.nushell.sh/
- dblohm7 2y agoAIUI the verbosity is by design to make scripts more clear, and users are expected to use aliases to make cmdlets easier to work with interactively. But I assume that few of those aliases are actually standardized...
- Jochim 2y agoVirtually all of the built in commandlets have one or more aliases set by default. e.g. Get-ChildItem is aliased to "gci", "ls", and probably "dir" as well.
- klingoff 2y agoPowershell introducing the English language to a shell at a time when everyone else was doing i18n is about 3 leaps beyond an annoying thing in the traditional Microsoft form of the time. You can do what ever you want for innovation but if you choose mindf*ck as your UI..
- masfoobar 2y agoI am a C# developer so I should feel right at home with Powershell. In some ways I am. I do manage to get things done if I have to use it. If I am inside the Windows environment (with other Windows devs) I will try to encourage using it over CMD. One thing I will give Powershell credit for is, back in 2012, being able to chuck something together when I did not have the development tools I needed. I knew that Powershell was .NET under the hood so I had a stab at being able to load my DLL files and calling methods inside a class. It did the trick! I was able to hand it over, suggesting they use it as a Task Scheduler (daily) and hardly anyone touched it during the remaining of that promotion (4 months) Despite all this, if I ever have to write a script for odd execution or regular automation... I wish I could use bash. I have mentioned Git For Windows or using WSL but I just cannot win anyone over. Its not like anyone is an expert on shell scripting.. powershell or whatever. As much as I like Powershell -- I still consider bash to be better. I think half of this reason boils down to what you are accustomed to. I have been using Linux properly since.. around.. 2006.
- chrisandchris 2y agoI am a C# developer and I know it's basically .Net as shell, but I have no clue what to do when in PowerShell. I'm always lost, and without searching the internet I get to nothing. In Bash/Zsh I quickly reach my goals. I just think coming from a Linux background, it's very hard to wrap my mind around the mindset of PowerShell which is just quite different from Bash.
- masfoobar 2y agoI just think if I had to write a quick "script" - I would stick to CMD or Powershell in Windows. If you had to write something a little more complicated, I would consider F# in many ways than Powershell especially if I wanted the .NET tools. Of course, there is python.