Re:PowerShell is open sourced and is available on Linux
by se6 on Thursday August 18, 2016 @01:38PM
(#12314653)
What about:
Edit: wrote back original command and replied below instead
[ Parent
| on HN ]
Re:PowerShell is open sourced and is available on Linux
by ksk on Thursday August 18, 2016 @01:41PM
(#12314676)
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 ~]$
Re:PowerShell is open sourced and is available on Linux
by se6 on Thursday August 18, 2016 @01:56PM
(#12314810)
Correction then:
ip addr | grep "inet " | cut -f 3 -d " "
Re:PowerShell is open sourced and is available on Linux
by ksk on Thursday August 18, 2016 @01:58PM
(#12314837)
It still doesn't work (you forgot to add the tr back in your reply after your edit)
[kapil@localhost ~]$ ip addr | grep "inet " | tr -s " " | cut -f 3 -d " "
127.0.0.1/8
192.168.128.236/24
[kapil@localhost ~]$
To be honest, I don't consider this to be that bad, I was just replying to a person who thought that bash was "simple", and powershell was "complex". Also, I don't have a problem with either tool. I'm very open to the idea that Microsoft can and does create awesome tech, despite having other shitty products.
Re:PowerShell is open sourced and is available on Linux
by se6 on Thursday August 18, 2016 @03:28PM
(#12315639)
Thanks, too many edits indeed!
Re:PowerShell is open sourced and is available on Linux
by Too on Friday August 19, 2016 @03:13AM
(#12318415)
Nice way to prove the point that object based is far more reliable than text based.
Re:PowerShell is open sourced and is available on Linux
by lottin on Thursday August 18, 2016 @02:59PM
(#12315354)
ip addr | awk '/inet / { print $2 }'
Re:PowerShell is open sourced and is available on Linux
by ksk on Thursday August 18, 2016 @03:05PM
(#12315427)
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.
Re:PowerShell is open sourced and is available on Linux
by brazzledazzle on Thursday August 18, 2016 @06:55PM
(#12316876)
You really couldn't have asked for a better chain to demonstrate the validity of your point. Having been blinded by my own world view and biases in the past I sympathize with them but this is too funny not to have a little laugh at their expense.
Re:PowerShell is open sourced and is available on Linux
by kondor6c on Thursday August 18, 2016 @10:04PM
(#12317539)
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.
Re:PowerShell is open sourced and is available on Linux
by 59nadir on Friday August 19, 2016 @01:28AM
(#12318134)
Well, to be fair, what was demonstrated here was that people didn't actually extract the data after multiple edits and tries, regardless of what tools they had at their disposal.
I think the idea of an object pipeline is sound for precisely this reason, but I don't think it should be connected to any one language or platform.
Re:PowerShell is open sourced and is available on Linux
by ksk on Friday August 19, 2016 @11:38AM
(#12320797)
First of all you are incorrect in your assumptions. You are reliant on the author of the tool in both cases. Just as there is no "UNIX Person" who decrees that all executables on UNIX must output text, there are vendors other than Microsoft who write software for Windows. You can write one too, it takes about 5 minutes to expose a powershell interface. And I'm not even a .NET developer. I write embedded software for a living.
Re:PowerShell is open sourced and is available on Linux
by JoBrad on Thursday August 18, 2016 @01:59PM
(#12314848)
But once again, you're simply scraping text, instead of querying an object for properties.
Re:PowerShell is open sourced and is available on Linux
by dzamo_norton on Thursday August 18, 2016 @02:25PM
(#12315088)
It is parsing text, but that text does have some consistent structure. Contained within it are properties. One can make the same comment of reading JSON or XML but I'll admit those are more like what you'd choose for an API. In general there is a not-entirely-obvious (to me) question of where does "formatted for machines" end, and "formatted for humans" begin? We can't say "it's for machines if and only if it must conform a schema that's defined in advance", not any more.
Re:PowerShell is open sourced and is available on Linux
by pessimizer on Thursday August 18, 2016 @02:52PM
(#12315301)
You would have to be aware of that fact in order to write the command. The question is about relative advantage, not about what the tools do.