Earlier quoted context omitted.
> the only people I've seen say nice things about powershell are microshit fanboys that don't know any better. I really like Powershell. If you install RHEL or Fedora I'm the 'mikem' in the default /etc/sudoers file.
Uh, okay?
PowerShell is open sourced and is available on Linux
281–290 of 790 posts
Re: PowerShell is open sourced and is available on Linux
#282Having powershell + bash on linux lets me compare this way: powershell, 14 pids(threads?), 3119M Virt size, 80160kb Resident. bash, 1 pid, 22068kb Virt, 3976kb Resident. And this is simply starting the process to an idle prompt. This is on a Debian 8 64bit system. (using their Ubuntu 14.04 binary)
PowerShell is basically an interpreter that works more like a Java Virtual Machine. Consider the hypothetical example that you need to lookup 100 users in an LDAP directory from Bash: You run the openldap command 100 times in a loop. That's 100 processes that need to fork and quit in a serial fashion in order to perform the task at hand.
To do the same thing in PowerShell you'll be calling a native PowerShell LDAP API which will execute all 100 lookups without having to fork any separate process resulting in a vastly faster execution.
It's better to think of PowerShell like the Python or Ruby interpreters. IMHO, PowerShell is a vastly superior improvement to cmd.exe as a shell but on a Unix host it will be inferior to bash for day-to-day tasks.
Re: PowerShell is open sourced and is available on Linux
#283Earlier quoted context omitted.
I wrote a bash script to sort processes by age on an old redhat 4 machine. What sounded like a very simple thing, quickly ended up being a complete nightmare of bash, python, and an unholy bunch of linux commands. It was ugly, and a terrible way of doing it, but we got it working. It would have been amazing if i could pipe PS into something that could sort by the dates on the 4th column, and return the last column in…
Pretty sure the section in the `ps` man page called OBSOLETE SORT KEYS indicates that even the `ps` on very old redhat machines could do this out of box... see the field `start_time`. Failing that, consider the `etimes` field (seconds since process was started) used in conjunction with the -o feature (control output format) so you can put `etimes` up front then simple pipe the output to `sort`. Those things being sai…
I was more just commenting on the fact that with a "strongly-typed" shell some of this stuff becomes much easier without every single tool needing to add all these options.
It gets much more "Unix Philosophy" when every command doesn't need it's own sorting logic, and doesn't need it's own date display logic, and doesn't need it's own way of displaying it to the user.
It can output an object, which can be piped into another program to use what it needs which can be piped to something else to do some sorting which can pipe it out to another to display it in a nice table.
Re: PowerShell is open sourced and is available on Linux
#284Re: PowerShell is open sourced and is available on Linux
#285Earlier quoted context omitted.
For programming , I agree. However, Python doesn't work as a system shell; for that, you want something optimized for running commands, without having to wrap them in a function call with a list of arguments as strings.
did you try xonsh?
Re: PowerShell is open sourced and is available on Linux
#286Earlier quoted context omitted.
I don't see a tremendous amount of accumulated wisdom in Powershell. It may be newer, but I'm not sure they looked at prior art or had design members who were shell gurus in any other shell than `cmd.exe`, which is a horrific shell. Why are commands horrendously long in powershell? If you spend time in the shell, you don't want your fingers falling off due to overuse. Aside... one of the design decisions Microsoft to…
> Aside... one of the design decisions Microsoft took that absolutely blows my mind is using `\` for file hierarchies instead of `/` That decision goes back to MS-DOS 2.11, circa 1983. (DOS 1.0 didn't have subdirectories.) The model for DOS directories came from UNIX, which at that time was the very aggressively defended intellectual property of AT&T. As Microsoft was an AT&T licensee -- for Xenix, their version of A…
https://blogs.msdn.microsoft.com/larryosterman/2005/06/24/wh...
Re: PowerShell is open sourced and is available on Linux
#287Earlier quoted context omitted.
C# incidentally solved many other shortcomings with Java. The languages are getting closer to parity, but for many years C# was pretty far ahead (if you only consider language features and not tooling/ecosystem). Between reified generics, better native interop, and many functional features, C# felt and feels more concise than idiomatic Java. And I've written plenty of both. Disclaimer: MSFT employee expressing person…
In what way was C#'s tooling not better?
As a .NET dev I'd actually argue that the things available to C# now are actually better (especially Visual Studio), but that's certainly biased.
Re: PowerShell is open sourced and is available on Linux
#288People laugh at me when I tell them I switched "back" to Windows after decades of Unix and Mac programming. But it's a really good, productive platform. Microsoft really seems to be heading in the right direction now. I hope .NET starts taking off on other platforms, too, because it really is a much better system than Brand "J".
Re: PowerShell is open sourced and is available on Linux
#289Earlier quoted context omitted.
[Disclaimer: I work for Microsoft.] As far as I recall, the original impetus behind what became PowerShell (as handed down to us in a conference room by Ballmer himself, sometime around 2001) was to fill the gap between ops people who did enterprise administration manually with tools like MMC and engineers who automated enterprise administration with tools like C++/DCOM. The latter were necessary in a lot of cases, b…
> So, yes, someone did ask for it - the IT industry. ... who couldn't use the well-known mature shell tools since they were locked into a closed platform, and Windows' cmd.exe was comparatively very weak.
You had two options: VBScript (which is a glorified COM+ agent) or a "real" programming language like VB6/C# which mixed COM+ with Win32 API calls (which are too hard to use for most non-programmers).
Powershell within itself does improve CMD. But that isn't primarily how PS pushed Windows automation forward, Microsoft said that every major server feature and server function should work in Powershell, so engineers at Microsoft had to look at it (be it their lacking COM+ interface, provide a new PS interface, or something else).
The net result isn't that CMD got replaced by something better. It is that we have a lot more APIs and ways of interacting with Windows features and services than we ever used to.
The ironic thing is that today you could write MS Dos-style console applications that work in CMD which provide all of this new automation functionality because of the Powershell push. Back before Powershell you'd have to hack it using unsupported APIs, registry entries and similar.
Re: PowerShell is open sourced and is available on Linux
#290Earlier quoted context omitted.
What about: ip addr show | grep inet Edit: wrote back original command and replied below instead
That doesn't work on my CentOS box. [kapil@localhost ~]$ ip addr show | grep inet inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host inet 192.168.128.236/24 brd 192.168.128.255 scope global dynamic eth0 inet6 fe80::215:5dff:fe80:501/64 scope link [kapil@localhost ~]$
ip addr | grep "inet " | cut -f 3 -d " "