4 ms·
If you are on Windows or Linux, Powershell is a decent scripting language that comfortably replaces Shell for scripted task running. The commands are vastly mor
by moritonal 4y ago
If you are on Windows or Linux, Powershell is a decent scripting language that comfortably replaces Shell for scripted task running. The commands are vastly more readable and you get an okay experience with branches.
I'd also say that in most cases Python is also a better choice, especially when you use the ! syntax.
- Woeps 4y agoThe issue I have with powershell is the extreem verbosity. But that's just a personal thing and not something that I can realy blame the language.
- Kwpolska 4y agoThe verbosity might be annoying at first, but it does make long pipelines easier to read. This enforced verbosity makes it easier to read than a linux pipeline using some arcane `qw -eRTy` command with no rhyme or reason.
- Woeps 4y agoNot to me, powershell is a pain to write and read with my heavy dyslexia. But again, this is personal. Pretty sure there are other dyslectics who will find that it helps them. So I guess this all depends on person to person
- moritonal 4y agoSo, as a fellow dyslexic. Powershell supports complete tab-completion for arguments (even with custom commands), and that includes doing things like writing "get-*" and hitting tab to see possible commands.
- partdavid 4y agoThe verbosity is optional; most examples you see will be verbose in an effort to be more clear (i.e. Get-ChildItem vs 'gci') but when you have a little experience are typing with Powershell, you'll find the verbosity basically goes away, because you'll be familiar with using aliases and because you won't need abstruse tools and sublanguages (which are more verbose) to do filtering and processing: gci *.txt | %{ $tot += $_.length }; echo $tot That's not more verbose than bash (one way of doing this): ls -l *.txt | awk '{ tot += $5 } END { print tot }' So you'll see the pipeline written (in an example, for clarity), more like: Get-ChildItem *.txt | ForEach-Object { $tot += $_.length }; Write-Output $tot But that's not how you'd usually use it; until/unless you're putting it in a script. Note that 'ls -l' and guessing that you want to total up field 5 is brittle in way that the Powershell snippet isn't, but I'm leaving that issue aside.
- partdavid 4y agoPowershell works great on MacOS; it's my primary shell.