I dislike windows (and by extension, powershell) because a solution such as changing the port the webserver runs on looks something like: New-ItemProperty IIS:\sites\DemoSite -name bindings -value @{protocol="http";bindingInformation=":8081:"} http://www.iis.net/learn/manage/powershell/powershell-snap-i... What did I just modify? Is it persisted to the hard disk? How do i back that up? How do I revert the change? How…
So how would you accomplish the same task on Linux using bash? What script would you write to set the web server's port to 1234?
In defense of PowerShell
61–70 of 82 posts
Re: In defense of PowerShell
#62I 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…
diff (cat out.txt | sort | out-string) (cat out.txt -raw)
do it?Re: In defense of PowerShell
#63The tab completion in powershell is frustrating to me. I never want to cycle through every available option (especially when many PSH commands have literally hundreds of switches). I want the tab-completion to only show options for which I've started typing the prefix. I want double-tab to print a listing of said options so that I can see them all at once. Is this possible? Right now it feels like there's a major lac…
But yeah, I don't like the cycling, either. I'd also prefer to get a list of the possible completions.
Re: In defense of PowerShell
#64Earlier quoted context omitted.
What about service apache2 restart
Or /etc/rc.d/apache2 restart, as one would find in the BSD world (and Slackware, with a bit of modification). This isn't to mention that it should be relatively trivial to map "restart-service $foo" to "/etc/rc.d/$foo restart" or "systemctl $foo.service restart" or whatever if one so chooses.
Re: In defense of PowerShell
#65I work primarily in a Microsoft environment, although I have Linux shell experience as well, and I totally don't get Powershell. What is a cmdlet? Why does it need a stupid made-up name like that? Why are all the commands incredibly verbose and hard to remember? I avoid using it at every opportunity.
As a Unix person, 'Restart-Service' seems a lot easier to remember than 'systemctl'. Edit: Restart-Service is also easier to remember than /etc/init.d was. Edit 2 (rate limit): `service` on RHEL is great, but it's a Red Hat-ism. Which is fine, I used to work at Red Hat, but still. It's also pretty limited: you use service to start/stop/restart, but you still use systemctl to list services, or list /etc/init.d (techni…
Re: In defense of PowerShell
#66Earlier quoted context omitted.
Some of us do, but we've given up trying to expose HN to the shell. The anti-Microsoft culture that built up in the late 1990s and early 2000s has too much inertia on HN to overcome by occasional articles.
The anti-Microsoft culture that was earned in the late 1990s and early 2000s has too much inertia on HN to overcome by occasional articles. FTFY
Re: In defense of PowerShell
#67I dislike windows (and by extension, powershell) because a solution such as changing the port the webserver runs on looks something like: New-ItemProperty IIS:\sites\DemoSite -name bindings -value @{protocol="http";bindingInformation=":8081:"} http://www.iis.net/learn/manage/powershell/powershell-snap-i... What did I just modify? Is it persisted to the hard disk? How do i back that up? How do I revert the change? How…
That example you gave is from 2008. You would use the current PowerShell Cmdlets provided for managing IIS. IIS:\>New-WebBinding -Name "Default Web Site" -IPAddress "*" -Port 80 -HostHeader TestSite https://technet.microsoft.com/en-us/library/ee790599.aspx
Re: In defense of PowerShell
#68Earlier quoted context omitted.
The anti-Microsoft culture that was earned in the late 1990s and early 2000s has too much inertia on HN to overcome by occasional articles. FTFY
I'm glad you pointed out it was earned , it's not as though the anti-Microsoft culture came from thin air
On a more topical note, one of the limitations of Powershell is it can only do basic math and (obviously) basic Algebra. To extend this, you can invoke .NET from the command line. Try these:
> $Area = [math]::pi
> $eight = [math]::pow( 2, 3 )
http://www.madwithpowershell.com/2013/10/math-in-powershell....
Re: In defense of PowerShell
#69Earlier quoted context omitted.
What about service apache2 restart
Or /etc/rc.d/apache2 restart, as one would find in the BSD world (and Slackware, with a bit of modification). This isn't to mention that it should be relatively trivial to map "restart-service $foo" to "/etc/rc.d/$foo restart" or "systemctl $foo.service restart" or whatever if one so chooses.
Re: In defense of PowerShell
#70Earlier quoted context omitted.
That example you gave is from 2008. You would use the current PowerShell Cmdlets provided for managing IIS. IIS:\>New-WebBinding -Name "Default Web Site" -IPAddress "*" -Port 80 -HostHeader TestSite https://technet.microsoft.com/en-us/library/ee790599.aspx
And THAT is the other thing. bash 7 years ago is the same as bash today, no changes based on some corporate overlords marketing idea of the month. Powershell is still in flux, and with MS as the owner, when will it ever be stable?