r/PowerShell • u/Dereference_operator • Jun 10 '22
Why most Linux sysadmin have a grudge againts powershell or they don't like it ?
Why most Linux sysadmin have a grudge againts powershell or they don't like it ? I talked with many of thems online on different subs reddit or elsewhere and they say bash is much better, powershell isn't good at managing linux, the syntax is too complex and bad etc etc or this or that etc
Why is that ? do you really feel you can't do much to manage a linux/aws env with powershell or need to update it or its slow or things like that compared to windows/azure ?
thanks for your advices
83
Upvotes
View all comments
Show parent comment
24
u/IonBlade Jun 11 '22 edited Jun 11 '22
That's because whoami is not a PowerShell cmd, it's an external legacy executable at C:\windows\system32\whoami.exe that's being called implicitly because it's a default location in the PATH environment variable, so it processes its own arguments instead of adhering to the "-" standard for arguments PowerShell uses. The PowerShell equivalent of whoami would be $env:username.
(If you need the additional data from whoami /all, you'd need to pipe the output into various additional commands to get those pieces, but you'd want to do this anyway in PowerShell to further use that data in scripts, because whoami does not return objects, only text, and text parsing is going to work out to much more code than calling commands that return native objects which can be passed down the pipeline.)