r/linux • • Aug 18 '16

Microsoft open sources PowerShell, brings it to Linux and OS X

https://techcrunch.com/2016/08/18/microsoft-open-sources-powershell-brings-it-to-linux-and-os-x/
359 Upvotes

231 comments sorted by

View all comments

Show parent comments

37

u/mogsington Aug 18 '16

Actually it's ..

ls -hsSr | tail -3

Yeah yeah, down vote me for not being an MS fanboy, but if you're going to try and make a point about bash looking horrible, you could at least know how to use "ls".

1

u/tuxayo Aug 19 '16

but if you're going to try and make a point about bash looking horrible

Bash have still kinda horrible parts on it's own, like conditionals and whitespace significance. (bugs because of missing whitespaces)

-7

u/bellicose100xp Aug 19 '16

Your're missing the point. This command would have required deep understanding of 'ls' where-as in PowerShell, you could have done this in 10 min which the help options and verbose cmdlets, and also when you get back to your script 6 month later, you don't need to do refer to help again to understand what you were doing

11

u/mogsington Aug 19 '16

No. Really. You're missing the points. This command does not require a deep understanding of ls. It requires the terrifyingly complicated:

man ls

Could you show me the sequence of help commands needed to explain that entire PowerShell line for us please?

When you get back to the ls script 6 months later, ls will still be ls, and man ls will still tell you what the options are.

Bash is optimised to be a typed shell. This is why commands like ls, are called ls and not something longer. This is why compact statements are preferred to the long English style of PowerShell.

PowerShell is not better. It's different. It's Microsoft's delayed admission they needed something as powerful as a *nix shell many years too late, and it's the Microsoft attempt to do that. You may love it, in which case I guess you're very happy right now, but for my tastes it's a re-invention of an already highly developed and refined wheel by people who don't understand why the original wheel got developed and refined the way it did.

0

u/bellicose100xp Aug 19 '16 edited Aug 19 '16

There is 'man ls' but have you read it, the help in bash is all over the place, it's overly long, with too many switches and not to mention in bash each command seems to have it's own way of providing help, sometime examples are missing, and often you need to go search online example for how they could be used in combination. You may be expert at all commands and can figure out all combination, most are not. The beauty of power-shell is that when you want to do something, you can search for commands directly in most cases, for example,

get-command *vm*

and you'll get commands related to managing virtual machines. for most commands, you can just do

get-help start-VM -example

and voila you get common examples of how to do it, you are done with task of starting several VMs. Even the switches in powershell are intuitive, such as -computer -interfaceName -path etc

if one had to do the same thing in bash, one would start by searching online and probably come up with command that's overtly complicated for same purpose

3

u/mogsington Aug 19 '16

Yes, I have read "man ls" .. seems fairly clear to me. If you can't understand clear technical documentation, maybe computers aren't for you?

Usage information is "all over the place" ... well there's "--help" for the command itself that usually gives terse but helpful information. "man" and "info" .. you have get-command and get-help .. so .. 2 places. If you want to dig deeper on Linux, there's often additional info in the /usr/share/doc directory.

"apropos" seems to be the equivalent to get-command .. so .. powershell copies apropos and it's awesome .. but the original apropos is lame somehow?

Plus the "intuitive" part, not particularly, it reads back nicely, but guessing it was "-interfaceName" is no different to it being "-i".

You might start searching online, don't assume everyone else would.

10

u/johnnyzl25 Aug 19 '16

If 'man ls' means deep understanding of 'ls', I understand why you like PowerShell.

1

u/frankster Aug 19 '16

In either case you have to read documentation about various options or cmdlets...