3 ms·
Not 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/l
by stackedinserter 2y ago
Not 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.
- Reasoning 2y agocurl and ps are both aliases in powershell for their respective posh equivalents. For some reason grep isn't though, I'll give you that. It also has positional parameters meaning you don't have to specify parameter names, though you might as well because tab completion is a thing. And if you're really keen on not using tab completion, it autocompletes parameter names for you meaning "get-help man -e" is equivalent to "get-help man -examples". Here are less verbose posh commands for your examples. (curl http://localhost:555/log -useb | select content | sls "2025[0-9-]+" -a).select.matches Still arguably a mess. Select-string not having a -o equivalent parameter is a big gripe of mine. (gps ffmpeg) or (ps ffmpeg) Get-Process has a name parameter. Why not use it? Edit: I should have added, curl ships with Windows now so a farer comparison would be a select-string on curl.exe.