Earlier quoted context omitted.
I've lived in both the windows and linux/unix worlds and I will say that powershell is a better scripting language than bash. Bash is ok, but powershell is nicer. Powershell is sort of like python in that it tends to force down a path of doing things in a certain way. Powershell isn't just "more tools and glue for windows stuff", it's a different way of doing things. In powershell you get named command-line parameter…
I'm not sneering at PowerShell because it's not Linux. And I think it's an impressive model. It's certainly a different way of doing things, and it's worth looking at and learning from. But Powershell people dismiss the bash and Linux model of "everything's a file", too, the same way others dismiss the Powershell model. They're different; neither is "unquestionably" better for all cases. Personally, once I start want…
In defense of PowerShell
81–82 of 82 posts
Re: In defense of PowerShell
#82I started off as a PowerShell fan, but my introductory experience has been pretty poor. A little while back, I tried testing the output of a sorting algorithm with PowerShell. I wrote a line of bash to check my results: diff Then I wrote the PowerShell: get-content output.txt | foreach-object { [Int] $_ } | sort-object | out-file -encoding ascii sorted.txt compare-object (get-content output.txt) (get-content sorted.t…
AFAICT, you are just trying to check if a file is sorted? Then wouldn't: diff (cat out.txt | sort | out-string) (cat out.txt -raw) do it?
I suppose the lesson is that if you want to preserve line order, you need to use -raw to prevent Get-Content (cat) from splitting the file into multiple lines. That still ruins the output text from Compare-Object (diff), but it's cleaner than fc.exe.
Thanks.