rpiboy
Posts: 110
Joined: Mon Mar 20, 2017 8:39 pm

PowerShell VS Bash

Thu Mar 30, 2017 1:50 am

Just a general question.
Why is Powershell so overly complex compared to scripting in Bash?
Also, does anyone here uses PowerShell if so what benefit there is to you compare to scripting in Bash?

Heater
Posts: 13700
Joined: Tue Jul 17, 2012 3:02 pm

Re: PowerShell VS Bash

Thu Mar 30, 2017 4:03 am

I would not worry about it.

PowerShell is a Windows thing. You are far better off using Raspian on the Pi. Or any where else for that mater, but that is another story. So you will be using BASH.

As it happens you can now use BASH on Windows as well, thanks to Microsoft introducing the Linux Subsystem for Windows. https://msdn.microsoft.com/en-us/commandline/wsl/about

That works quite well. Although I did manage to hang it up when trying to build a large Linix program with it. Amazingly I got that program compiled on my Debian PC and moved the binaries to Windows. They work fine under the Linux Subsystem.
Memory in C++ is a leaky abstraction .

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: PowerShell VS Bash

Thu Mar 30, 2017 4:09 am

rpiboy wrote:Just a general question.
Why is Powershell so overly complex compared to scripting in Bash?
Powershell attempts to include the underlying scripting language and an all powerful standard library all at once. Bash doesn't worry about having any libraries. And we know that powershell's library isn't your ordinary standard library like with C where there is some limiting scope because powershell keeps adding more functions endlessly by the pail full. It also seems overly complicated because it is so verbose, as it uses a verb noun imperative form with full words spelt out. The authors would argue, I think, that it makes up for all those things by being extremely consistent, something that is utterly lacking in bash. Whether they are right or not, I would like to clobber them on the head with a canoe paddle for aliasing 'wget' to their own thing that isn't anything like wget. That's too much.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: PowerShell VS Bash

Thu Mar 30, 2017 4:15 am

Heater wrote:PowerShell is a Windows thing.
Apparently they are porting powershell to linux. I'm not sure what that really means, it seems like a good lot of it is focused on things that are only in windows. But then they've also released powershell for the slight versions of windows, e.g. Win10 IOT, but it only includes the 'core' functions. Core functions means all the functions expect except the ones you need, I've learned that much.
Last edited by stderr on Fri Mar 31, 2017 10:57 pm, edited 1 time in total.

User avatar
PeterO
Posts: 5086
Joined: Sun Jul 22, 2012 4:14 pm

Re: PowerShell VS Bash

Thu Mar 30, 2017 5:47 am

stderr wrote: Core functions means all the functions except the ones you need, I've learned that much.
I think that's what you meant to say ?
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
Mortimer
Posts: 923
Joined: Sun Jun 10, 2012 3:57 pm

Re: PowerShell VS Bash

Thu Mar 30, 2017 5:49 am

It's there on Github:
https://github.com/powershell

I haven't tried it though.
--------------
The purpose of a little toe is to ensure you keep your furniture in the right place.

Koeshi
Posts: 228
Joined: Sun Mar 20, 2016 11:16 am

Re: PowerShell VS Bash

Fri Mar 31, 2017 12:15 pm

I tried installing PoSh from the AUR but it takes a hell of a long time to build. Unless you are working with Windows servers there isn't really any need to have it though, it is very cumbersome compared to Bash and even command prompt.

hortimech
Posts: 323
Joined: Wed Apr 08, 2015 5:52 pm

Re: PowerShell VS Bash

Fri Mar 31, 2017 12:33 pm

Koeshi wrote: Unless you are working with Windows servers there isn't really any need to have it though,
Ever heard of a Samba AD DC ?

The only problem is, the very cmdlets you need, don't come with the Unix version of powershell

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: PowerShell VS Bash

Fri Mar 31, 2017 10:54 pm

PeterO wrote:
stderr wrote: Core functions means all the functions except the ones you need, I've learned that much.
I think that's what you meant to say ?
PeterO
You are exactly correct, I certainly did mean to say that. You'd think I could correctly spell the words in my attempt at a punch line but sometimes not.

I do think that powershell is frustrating because it does not include all of powershell in all releases of current powershell. This is not a problem for bash, all versions of bash with the same version number should include, and as far as I know do include, all of bash.

This not including stuff is probably directly related to the fact that powershell attempts to include what otherwise would be external libraries right in powershell itself, although it does have external libraries anyway. It is possible some of the trouble is derived from microsoft worrying that including too much in low end devices would create, I think the cool kids call it "memory pressure".

But couldn't this be avoided by letting the programmer decide which parts of the whole that he needed to include in his particular program? Another possible reason for not including all of powershell in all versions of powershell is less forgiveable, namely that microsoft thinks that if they did include all of powershell in the powershell of the versions of windows they are giving away free, people wouldn't buy so many copies of the versions of windows they are not giving away free.

JamesPi123
Posts: 111
Joined: Fri Sep 23, 2016 10:02 pm
Location: Inside my Pi
Contact: Website

Re: PowerShell VS Bash

Thu Apr 13, 2017 3:59 am

Bash is open source - you can create variants of it

mihol
Posts: 23
Joined: Wed May 09, 2012 6:55 pm
Location: Germany

Re: PowerShell VS Bash

Tue Sep 12, 2017 5:31 pm

JamesPi123 wrote:
Thu Apr 13, 2017 3:59 am
Bash is open source - you can create variants of it
PowerShell is open source too.
Admitted this happened not so long ago but is from my view the right approach all software should use

mihol
Posts: 23
Joined: Wed May 09, 2012 6:55 pm
Location: Germany

Re: PowerShell VS Bash

Tue Sep 12, 2017 5:46 pm

rpiboy wrote:
Thu Mar 30, 2017 1:50 am
PowerShell ... what benefit there is to you compare to scripting in Bash?
there is a comparison with a focus on security, maybe this helps.
https://blogs.msdn.microsoft.com/powers ... -security/

Return to “Off topic discussion”