Earlier quoted context omitted.
> 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…
First off, readelf shouldn't switch between hex and base10. Secondly, that's DSV, so you shouldn't have written a regex for it. You should have either cut, or awk, both tools SPECIFICALLY DESIGNED to do what you want.
PowerShell is open sourced and is available on Linux
741–750 of 790 posts
Re: PowerShell is open sourced and is available on Linux
#742Earlier quoted context omitted.
The default regex functionality is absolutely terrible How so?
Replicate the above without using [Regex]:: (i.e. use -matches and $matches). It forces you to radically depart from a typical Powershell mindset and approach.
gci *.js | foreach { gc $_ | foreach { if ($_ -match ..) { $Matches...
which is ugly, but doesn't use [regex]::Matches. But you can do: sls 'require\("(.*?)"\)' *.js | select { $_.Matches.groups[1] }
or other variants of Select-String, depending on exactly what data you want, without departing into the .Net Framework too far.Re: PowerShell is open sourced and is available on Linux
#743 milek7: ~$ time powershell exit
real 0m3.323s
user 0m4.140s
sys 0m0.507s
Seriously?Re: PowerShell is open sourced and is available on Linux
#744milek7: ~$ time powershell exit real 0m3.323s user 0m4.140s sys 0m0.507s Seriously?
milek7: ~$ time bash -c exit
real 0m0.009s
user 0m0.007s
sys 0m0.000sRe: PowerShell is open sourced and is available on Linux
#745Earlier quoted context omitted.
Because the requirements change depending on which one you're doing: quick shell automation isn't the same as the kind of automation you'd use perl/python for.
And yet most of the time I see bash being used for the same kind of automation that you think is good for perl/python. And not because bash is good, but because it is what people know (since they use it interactively) and because it is installed everywhere. So if someone had a tool that was installed everywhere, and used interactively, that could also be used to create more robust automation tasks, that seems like a…
As for interactive use and robust automation, Bash isn't as bad as you'd think. The reason I'd go to python is because of script complexity, not lack of robustness.
Re: PowerShell is open sourced and is available on Linux
#746Earlier quoted context omitted.
That is not quite right either. I enter about 200 commands on a normal workday and write maybe two scripts a month in a shell language. A shell language should be a shell language, it's not merely a stepping stone to write a script after using a command just once. If that's what I'm looking for I'll use Python. And from the other side, Python would be a terrible shell (by default), and that's fine because that's not…
This is a really strange argument -- he's saying that PowerShell was designed so that you could more easily move from shell to script to library ... Your counter is -- you don't do that? Of course you don't, because your shell is bash. That's exactly the point. If your shell is bash, when you write a script you use a different language. What if there was a shell where you could actually script ... You're absolutely r…
Yeah of course I'd use Bash because Powershell only just became available for other platforms, but that's not my point.
I understood his point like this: the grandparent of his post said powershell has some bad things for scripting. Someone responded to that by saying it's not just for scripting. He said something which I understand as 'that's not quite right, I see a command as a stepping stone to writing a script', To which I finally responded 'I enter a lot of commands but rarely write scripts in [my interpreter of choice's language] because that language just isn't that great, and that's fine because the language is great for its purpose: command line usage'.
And compromises are inherently bad (in a way), that's the definition of a compromise: there are two or more mutually exclusive options and different parties have different first choices. Since they're mutually exclusive, a compromise must be made which is acceptable for both, but it's the first choice of neither (or at most one of them). Compromises are necessary for a dual-use language, but they don't make it prettier for both usages either.
Re: PowerShell is open sourced and is available on Linux
#747Earlier quoted context omitted.
First off, readelf shouldn't switch between hex and base10. Secondly, that's DSV, so you shouldn't have written a regex for it. You should have either cut, or awk, both tools SPECIFICALLY DESIGNED to do what you want.
What's DSV?
tr -s [:blank:]
To cut, which will give you the row you want.Re: PowerShell is open sourced and is available on Linux
#748Earlier quoted context omitted.
Are you out of your mind? Or do you just not understand what you're saying? Adding an interface to PS to get this info natively is good. But Lennart has a magic ability to get everything wrong, and he's NOT messing with my fstab any more than he already has.
Then which audio system is simple to set up AND allows per-program volume, effects, etc? Which init system "just works" without requiring me to copy and modify a hacky init script from stackoverflow? Lennarts products are controversial, but they’re the classical "least worst" options.
JACK
>Which init system "just works" without requiring me to copy and modify a hacky init script from stackoverflow?
s6, runit, bsdinit (yes, really).
>Lennarts products are controversial, but they’re the classical "least worst" options.
No, they're ugly, broken messes that look nice. Systemd is a monster. If it was an init system, I wouldn't complain, but it's not. It's an init system that's also a cron replacement, a syslog replacement, an automount replacement, a docker replacement, a consolekit replacement, steadily gaining a tight integration with udev, overcomplicates everything it touches (we need a hostname daemon now?), provides libraries to high-level userland that are DELIBERATELY POSIX incompatible, promotes binary formats for no reason, flies in the face of tradition for no reason and breaking code (screen sessions die now), overcomplicates PID1, increasing the chances of a kernel panic, and that's just the tip of the iceberg.
Systemd is a tiny step forward, followed by a massive step back, and of you can't see that, you haven't been paying attention.
Re: PowerShell is open sourced and is available on Linux
#749Earlier quoted context omitted.
That is not quite right either. I enter about 200 commands on a normal workday and write maybe two scripts a month in a shell language. A shell language should be a shell language, it's not merely a stepping stone to write a script after using a command just once. If that's what I'm looking for I'll use Python. And from the other side, Python would be a terrible shell (by default), and that's fine because that's not…
You're correcting Jeffrey Snover about the point of Powershell. I suspect that the guy that invented it and championed it through years of resistance at Microsoft probably knows what is or isn't intended with Powershell.
I'm sure he knows a lot more than me about a lot of powershell-related things. Still, beyond him being (according to you) the inventor and "champion" of powershell, there's nothing that tells me they did UX research into this, so I added my experience because it differs from his viewpoint.
Re: PowerShell is open sourced and is available on Linux
#750Earlier quoted context omitted.
That is not quite right either. I enter about 200 commands on a normal workday and write maybe two scripts a month in a shell language. A shell language should be a shell language, it's not merely a stepping stone to write a script after using a command just once. If that's what I'm looking for I'll use Python. And from the other side, Python would be a terrible shell (by default), and that's fine because that's not…
Windows did ship with VBScript (and probably does still). You can also install languages via a package manager; an example: - https://chocolatey.org/packages?q=python
Windows still ships with VBScript, but it's not a language I'd want to look into either. Everyone that has worked with it sighs when it comes up and nobody actually uses it for automation as far as I know (everything's either powershell, good old batch scripts, or custom .NET software).