Earlier quoted context omitted.
That doesn't work either. [kapil@localhost ~]$ ip addr | awk '/inet / { print $2 }' 127.0.0.1/8 192.168.128.236/24 [kapil@localhost ~]$ You guys are just proving my point. _I_ already know how to do it using bash. Its just that using objects and querying properties is far simpler . And I just took a random example because its a common thing that someone would want to do.
I think what others might be demonstrated is that there isn't a reliance on what object Microsoft decides to ship to you, in *nix we can combine commands and builtins and get the information in the structure we need without having to wait 8 months for a system reboot (or worse a paid for upgrade) that will give us what we need.
PowerShell is open sourced and is available on Linux
711–720 of 790 posts
Re: PowerShell is open sourced and is available on Linux
#712Earlier quoted context omitted.
getting an IP is still pretty ugly, somehow: ip address show dev eno1|grep 'inet '|cut '-d ' -f6 But I wouldn't call it unreliable. The cut is the only really nasty bit. Changing your fstab is easy with a little awk: $2=="/tmp"{$4=$4 ",nosuid"} {print $0} Given, it won't remove contradicting options...
It's unreliable, because you don't know where you'll find 'inet ' or what's the specific spacing of the output. Also, that's not the ip, because you've still got the cidr attached. And no, fstab is not easy either. For example it fails for: # /tmp has option_blah in order to ... changing it to: # /tmp has option_blah,nosuid in order to ... Confusing the next person to look at the well intended comment. It's no imposs…
Re: PowerShell is open sourced and is available on Linux
#713Earlier quoted context omitted.
Hey, don't forget cut and xargs!
And paste for tasks requiring the opposite of cut, then there's tr, the lightweight sed. And jq for structured queries on JSON. But, all these are built in to poweshell, essentially.
Re: PowerShell is open sourced and is available on Linux
#714I am pretty excited about this as I have few cross-platform languages that I can use (due to conditions at work). I am wondering how many distros will adopt it into their repos.
I fully expect this to be in the AUR in under a week. Probably within 48 hours, even.
Re: PowerShell is open sourced and is available on Linux
#715Earlier quoted context omitted.
except that C# as a language is by leaps and bounds better than Java (both in syntax and useful features departments), so there have been other problems to solve, too.
Its ecosystem isn’t. C# will never get accepted as an open source product. It only has open source code, it’s not actually ‘open-source.’ Compare it with Typescript, which—despite originating from Microsoft—is a truly open project, and getting love left and right. C# might be better than Java/JVM, but it’s not better enough. The culture/ecosystem barrier is so high that C# would have to be miles ahead, technically su…
/nitpick
Re: PowerShell is open sourced and is available on Linux
#716Earlier quoted context omitted.
It's moving the goal posts a bit to suddenly restrict this discussion to only servers, no? There are plenty of Windows servers running plenty of businesses. They may not outnumber non-Windows servers, but I don't think "majority" has to be a prerequisite for "flourish". There are also buildings full of Windows clients...
This discussion is about PowerShell, which is primarily intended to automate server management and has been ported to Linux, presumably, for the same purpose.
Many (me included) find PowerShell extremely useful for automating any sort of Windows management, client or server. So I disagree that the discussion should be implicitly assumed to be limited to Windows servers.
Re: PowerShell is open sourced and is available on Linux
#717Earlier quoted context omitted.
It is a lot better for C#. All the features work perfectly for .NET languages, but because of the nature of C++ it's a lot harder to get these kinds of things working well with it. Some answers about why are here: https://www.quora.com/Why-is-C++-intellisense-so-bad-in-Visu... Eclipse can run better on a potato but it's also very simplistic. You should also be able to turn off most of the features you don't want in V…
Well, heck even Emacs with some LLVM wrappers can do better job at C++ Intellisense than Visual Studio. Eclipse's CDT runs circles around it as well (so much for being very simplistic). And don't get me started on trying to use Intellisense on large codebases - such as Unreal Engine's source code. It is just completely unusable (30+ seconds before the completion pops up, often blocking your IDE (a total usability no-…
Re: PowerShell is open sourced and is available on Linux
#718Earlier quoted context omitted.
I find that to be the issue. You are considering it just RAW text when it is actually formatted text that has been parsable for years with common unix command line tools. It not being in the format you consider a structured object does not mean it's not a object or even parsable. If you are using ad hoc regex I suspect you are not using all the tools available to you. I feel like Kernighan and Pike do a much better j…
> You are considering it just RAW text when it is actually formatted text that has been parsable for years with common unix command line tools. Parsing command output with sed/awk/etc (ie. "common unix command line tools") is absolutely an ad hoc parser. Let me give you an example that I recently ran into. I have a tool that parses the output of "readelf -sW", which dumps symbols and their sizes. The output normally…
Re: PowerShell is open sourced and is available on Linux
#719Earlier quoted context omitted.
This isn't about binary vs text, it is about structured vs. unstructured. The legacy of UNIX is flat text. Yes it may be expressing some underlying structure, but you can't access that structure unless you write a parser. Writing that parser is error-prone and unnecessary cognitive burden. PowerShell makes it so the structure of objects is automatically propagated between processes. This is undeniably an improvement.…
If the data was in JSON it would promise a that it followed the JSON spec -- but its not, it follows its defined spec, which in the case of readelf is apparently undefined. Other programs that expect to be machine parsable define in great detail the output. In your initial post I replied to you mentioned ps. In the case of ps it has many options to help you get the data you want without using standard parsing tools.…
Re: PowerShell is open sourced and is available on Linux
#720Earlier quoted context omitted.
So much this. What the M$ community fails to see is that text streams can be consumed by __everyone__. We've basically all accepted the fact that programs are used longer and in different ways than we'd expect. A brittle object model can only lead to vendor lock in and indigestible output.
The dollar sign is charming. There's a few points here: 1) Not all data is text. In fact, very little of the data people see/work with day-to-day is raw text. It's silly to transform a PNG image into text to be able to pipe it around. (Or to pipe around its filename instead and have a dozen tools all having to open and re-parse it each time.) 2) There's nothing on PowerShell preventing you from serializing a piece of…
Secondly, if you used DSV to parse PS, like you should, adding a new column to the end won't break anything. A fancier parser won't even break if you add to the middle, but that's usually not worth the effort to write.