4 ms·
Check out powershell
by tonymet 2y ago
Check out powershell
- UltraSane 2y agoI've actually written many thousands of lines of Powershell for work and play. I first learned it because Vsphere used it for a CLI but I soon learned to love piping objects and filtering by property name. beat the hell out of bash that is for sure. And the ConvertTo-JSON command is amazingly useful.
- crabbone 2y agoIt's so bad that I'd actually take the decades of cruft over it. It was made by people who don't know how to use existing tools and what the actual problems are. It's like people who keep creating "new" text editors, but they never learned well how to use existing ones. So they end up with crippled half-baked thing that's some concept from the 80s that was discovered to be a dead-end in the 90s, but with modern cosmetics. PowerShell is just incompetence and hubris of people working for a large company which can push their random garbage software on a lot of users and developers due to having huge market presence.
- ykonstant 2y agoWhat are your specific criticisms of PowerShell?
- stackedinserter 2y agoNot the OP, but everything requires tons of case sensitive typing. It's easier to just write python script instead of typing this (curl http://localhost:5555/log http://localhost:5555/log | grep -o -E "2025[0-9-]+") (Invoke-WebRequest -Uri "http://localhost:5555/log" -UseBasicParsing).Content | Select-String -Pattern "2025[0-9-]+" -AllMatches | ForEach-Object { $_.Matches.Value } or this (ps ax | grep ffmpeg) Get-Process | Where-Object { $_.ProcessName -match "ffmpeg" } Maybe it's good for scripting (why not python then?) but really sucks when you need to get things done in terminal.
- tonymet 2y agoI agree. I use SetAlias ss Select-String or gm / Get-Member but you’re right the language is too verbose. Auto complete is quite good though.
- zokier 2y agoPowerShell is mostly case insensitive, `get-process` works as well as `Get-Process` or `GET-PROCESS`
- tolciho 2y ago`ps ax | grep ffmpeg` sometimes will match grep itself, so either prevent the match from matching itself, or maybe instead use pgrep(1). $ ps ax | grep ffmpeg 66898 pe S+p 0:00.01 grep ffmpeg $ ps ax | grep '[f]fmpeg' $ pgrep ffmpeg $ As for PowerShell, it does not seem useful, but then again I live mostly on OpenBSD and in the terminal.
- UltraSane 2y agoPowershell has very good tab completion. It isn't a problem. And it is case insensitive.
- diflartle 2y ago> or this (ps ax | grep ffmpeg) > > Get-Process | Where-Object { $_.ProcessName -match "ffmpeg" } The way to write that on the command line Powershell would be: ps ffmpeg Whereas your longer example is what you put in the PS1 file.
- UltraSane 2y agoThis is the single worst take I have ever read on Hackernews. You didn't actually give a single concrete reason why PowerShell is bad. I will give a major reason why it is AWESOME: objects are piped instead of text. This single change makes a ridiculously huge improvement. You are no longer forced to perform incredibly tedious and fragile text manipulation. This also enables filtering on property names and the ConvertTo-JSON command which is amazingly useful.