It's always been my opinion that PowerShell (powerscript?) has been poorly named -- it's a lackluster /shell/ although things like psreadline,powershell_ise,etc make it less awful as a shell on windows but it's great as interpreted (ish -- see DLR/JIT) .NET -- you can compile C# inside of it or call any .NET library you have laying around. It is a scripted programming language .. comparing soley to zsh/bash is a bit like comparing zsh/bash to python/irb with some shortcuts/syntax sugar to make it more "shell"-like. Lee On Thu, Aug 18, 2016 at 6:49 PM, Eli Schwartz via arch-general < arch-general@archlinux.org> wrote:
While I tend to prefer Unix-style shells, there are *some* things that PowerShell does better.
Here's an example I found on Reddit in the thread about this on /r/linux. Both of the following commands find the size and name of the three largest files in a directory.
Bash: ls -l | sed 's/ \+/,/g' | cut -d',' -f 5,9 | sort -g | tail -3 PowerShell: ls -file | sort -pr length | select length, name -l 3
What seems to be the most noticable difference is that PowerShell, being an object-oriented language, pipes objects instead of raw text. I think
On 08/18/2016 09:28 PM, Hunter Connelly via arch-general wrote: this might
make many things easier while writing scripts.
Excellent, let us programmatically parse the contents of `ls`!
What, exactly, is wrong with the bash command: find . -maxdepth 1 -printf '%s %p\n'|sort -nr|head -3
I will agree that if your godawful bash command was what you had to compare to PowerShell, then PowerShell would be better...
But by all means, pick and choose, then compare bad bash to good PowerShell if you feel it makes your point better.
As for objects, if you feel you need them you are probably doing something complex enough to justify an actual scripted programming language e.g. Python. But I doubt you have that great a need for an interactive shell.
-- Eli Schwartz