Great! So I can now run bash on windows (with WSL), open tmux, and open powershell prompts in each tab: the loop is complete! I wish powershell's documentation was a bit more clear about what's powershell 1.0, 2.0, 3.0... Etc. A lot of time I'd find a verbose and tedious way to do one thing because the code was written in "old powershell", when the latest version had a much more elegant solution (either because of ne…
PowerShell is open sourced and is available on Linux
131–140 of 790 posts
Re: PowerShell is open sourced and is available on Linux
#132Earlier quoted context omitted.
You can use control-O for that, which does "execute this command as if I pressed enter, then when it's done bring up the following command in command line prompt". So if you have a set of commands to run that are 20 lines up in history, you can first find them (with 20x UP or by reverse-search), then just control-O control-O control-O control-O ... to execute them one after another.
Oh. My. God. Life changing! Out of curiosity, how did you discover that you could do this?
Re: PowerShell is open sourced and is available on Linux
#133PowerShell is my guilty pleasure of the computing world. Once you've piped strongly-typed objects around between your shell commands, text scraping seems barbaric by comparison. The problem, of course, is that you can't use all that power for much, since the pool of PS-compatible tools and utilities is much shallower than it is for Unix shells. I'm really hoping this will help spur a new wave of PowerShell-compatible…
I love the strongly-typed cookies but I absolutely hate the powershell syntax. It's like C# and Bash got together and had a really ugly baby.
Re: PowerShell is open sourced and is available on Linux
#134Earlier quoted context omitted.
Very much so. They're returning to their roots(winning over developers with world-class tools) and it's really refreshing to see. Between this, VSCode and .NET Core it really is an impressive effort.
Let's hope the awesomeness they are showing on the developer relations side finally leaks into the Windows side and they stop their shenanigans with W10 and Android and VFAT patent threats. It's so disappointing to see this kind of split-brained behavior.
Developers are pretty much the only demographic that might realistically switch operating systems, so they only really need to cater to them. The rest, they can pretty much treat however they want, and they won't lose them as customers.
Re: PowerShell is open sourced and is available on Linux
#135Earlier quoted context omitted.
Scripting. While I typically use Bash on Windows to use grep to interactively test my webserver, I'm much happier using Powershell ISE (which I don't know was ported [1]) to write standard tests with multiple parts, particularly ones that require e.g. checking cookies on the response. 1. Looks like they ported a service that does the same. https://github.com/powershell/powershelleditorservices
Can you be more specific? Powershell instead of using grep? Or as a testing framework? Or an embedded interactive REPL? I mean, just broadly, with basically zero knowledge of powershell, what I see is a custom scripting language with a set of common 'macro' commandlets that do little tasks. ...but, I don't see how that's useful? How do you import a package to upload a file to S3? I can't just install https://aws.amaz…
but there are standard http post/get/put commands so you can write your own.
Re: PowerShell is open sourced and is available on Linux
#136Earlier quoted context omitted.
As long as you bear in mind that it's main purpose is a usable replacement for the CMD.EXE batch language, then you should be willing to forgive Powershell it's warts.
Except that they added a bunch of new warts that don't have any relation to CMD.EXE. They took the opportunity to re-invent how a shell works from the strongly-typed object perspective but then they copied some of terrible syntax of 40 year old unix shells. I just don't understand it. I'd rather write scripts in pure C#.
Re: PowerShell is open sourced and is available on Linux
#137Cool! I'm having a play with it and it seems to work really nicely. Does anyone know why the following commands don't produce the same output? get-childitem | ConvertTo-Csv get-childitem | ConvertTo-Json | ConvertFrom-Json | ConvertTo-Csv It seems like, if there's a perfect underlying data model doing what's effectively an identity conversion shouldn't change anything. Edit oooo, and all the linux stuff is available…
For your first question: you have converted types. When you did a ConvertTo-Json, you serialized the System.IO.DirectoryInfo type into JSON compatible data. When you ConvertFrom-Json you have a PCSCustomObject.
The conversion to CSV is different for the System.IO.DirectoryInfo than the PSCustomObject. This has to do with the sub-types (converting from objects into serializable JSON objects). It also appears to handle time strings differently as well.
Re: PowerShell is open sourced and is available on Linux
#138PowerShell is my guilty pleasure of the computing world. Once you've piped strongly-typed objects around between your shell commands, text scraping seems barbaric by comparison. The problem, of course, is that you can't use all that power for much, since the pool of PS-compatible tools and utilities is much shallower than it is for Unix shells. I'm really hoping this will help spur a new wave of PowerShell-compatible…
Is this really so useful in practice? I have never used PowerShell before (nor do I have plans to do so in the near future), but I would imagine the downside is complexity, both for user and especially for developers. With text you just read and parse, while with objects you need to know the object type, its fields,... Whatever happend, I hope text stays here (and I have a bad feeling about it ever since I met system…
Re: PowerShell is open sourced and is available on Linux
#139PowerShell is my guilty pleasure of the computing world. Once you've piped strongly-typed objects around between your shell commands, text scraping seems barbaric by comparison. The problem, of course, is that you can't use all that power for much, since the pool of PS-compatible tools and utilities is much shallower than it is for Unix shells. I'm really hoping this will help spur a new wave of PowerShell-compatible…
Re: PowerShell is open sourced and is available on Linux
#140Earlier quoted context omitted.
I find it massively useful in practice, even for mundane tasks. For example, the other day I was trying to search the columns of a very large SQL Server table¹ but also needed information about the column type. …\dbo.site> ls Columns | select Name, DataType, {$_.Properties['Length'].Value} | where {$_.Name -like '*int*'} Name DataType $_.Properties['Length'].Value ---- -------- ----------------------------- internal_…
> Quick, easy. In a *nix shell that would be very tricky. You'd probably need to make an explicit SQL query since you wouldn't have the database integration.
If, hypothetically, bash had database integration, ls Columns would probably return something like
foo varchar 30 NOT NULL
bar decimal 8
baz int 4
Which would be a royal PITA to search for anything in—if I were to search for ‘int’ I'd get all int columns and any columns with int in the name….I could've used an example involving process lists, but I didn't want to trigger PTSD in anyone who's had to grep the output of ‘ps’ for anything non-trivial. (Plus, the database thing was something I actually did a few days ago.)