Live data from Hacker News

PowerShell is open sourced and is available on Linux

azure.microsoft.com

201–210 of 790 posts

Re: PowerShell is open sourced and is available on Linux

#201
post #63

Earlier quoted context omitted.

I feel that principle is true from all high-level languages as you move down the chain. Shell scripts should be 1-20 lines. Python/Ruby/whatever for 20-100 and compiled for anything >100.

Respectfully disagree. I've been writing full-on applications using Python and Qt4 which are well over 100 lines of code.

That's cool, we are just different is all. I use Python for automation tasks that require more than what I can do with Bash/Batch/PowerShell but don't warrant a full write/compile/deploy process. If your job is working in Python then sure you are going to use it way past the limits of what I would use it for.

Things are a lot nicer these days than 10 years ago though with PyCharm, etc. it makes managing a Python project so much easier.

Re: PowerShell is open sourced and is available on Linux

#202
This might come across as a little rude, but I really wish Windows developers stayed away from Unix. I moved away from Windows a long time ago because I didn't want anything to do with Windows or Microsoft, and I went to great lengths to avoid their software and their proprietary file formats. Now we had command-line interfaces, desktop environments, running on top of an incredible, powerful Unix-like OS. It was free software, and it was Microsoft-free. Please, don't ruin it.

Re: PowerShell is open sourced and is available on Linux

#203

Finally! I love the methodology behind PowerShell. It's more verbose than bash, and that's OK to me. The readability and _consistency_ far outweigh the extra characters. Now, I get that coupled with all the flexibility of *nix tooling. It's going to be a long road to hook everything up, but this has the chance to finally standardize command parameters. I'm sorry. This is truly amazing to me and I'm quite excited!

I Can Only See One Problem With PowerShell :)

Powershell is case-insensitive, so feel free to avoid that shift key if you're so inclined :)

Re: PowerShell is open sourced and is available on Linux

#204
PowerShell is one of Microsoft's better offerings, it runs rings around Batch, thank heaven. However, it has its own quirks. Loads and loads of stuff done implicitly (unwrapping arrays as parameters when constructing an object?) and the .Net integration can be annoyingly flaky. Add in the bizarre syntax, some kind of halfway house between Bash and C#, and you quickly end up writing enough code to hang yourself.

My favourite: defining functions more or less like any other C-inspired language: function abc([string]$param1, [string]$param2) { #do stuff }

...but if you CALL that like any other C-inspired language: abc("string1", "string2)

PowerShell mashes the two strings together and ignores the second parameter. Drove me mad when I started out. Incredibly inconsistent.

I like Microsoft's effort here, and the design is a lot better, working with objects, but not on my Devuan box!!

Re: PowerShell is open sourced and is available on Linux

#205
post #54

Earlier quoted context omitted.

Bash is 27 years old. It was written to replace the Bourne shell, which is 39 . It is not terribly surprising that a 9 year old tool like Powershell made some improvements over an earlier tool that was already old enough to vote!

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 AT&T System 7 UNIX, which was Microsoft's vision of the future of operating systems when PCs became powerful enough: they licensed it in 1978 and resold it via OEMs -- I speculate that they were afraid that AT&T might sue them for patent or copyright violation relating to the filesystem design if they went with a forward slash.

Re: PowerShell is open sourced and is available on Linux

#206

Earlier quoted context omitted.

Powershell can use any .NET library... "Nobody" meaning you. Which is perfectly fine. But there are quite a few users of Powershell out there.

Now that it exists there are users, but when people were hoping for a modern or more portable replacement for DOS batch files I'm not sure this is what they had in mind.

Think of it as a replacement for vbscript instead, with a commandline.

Re: PowerShell is open sourced and is available on Linux

#207

Earlier quoted context omitted.

> With text you just read and parse, while with objects you need to know the object type, its fields parsing is actually a huge pain in general. a lot of unixy tools produce different output when their stdout is not a terminal to be more pipeline-friendly. That output is generally easier to parse (often tab-separated or so), but you still need to know the same things about the output (the "type" could be whether it c…

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…

It's entirely possible this is a recent development, but "ps -o cmd --sort etime" seems to do what you're asking for.

Re: PowerShell is open sourced and is available on Linux

#209

Earlier quoted context omitted.

I'm not at all convinced that the syntax is any better for typing in as commands in an interactive shell.

I think it works pretty well for that beyond the weird omission of anything like &&

It works fine as an interactive shell but that's not exactly high praise. It could be better for that and for scripting but instead tries to be more familiar to bash users. As a bash user, I'm terribly happy about it's syntax either but it's the price to pay for 40 years of backwards compatibility. Powershell has no such excuse.

Re: PowerShell is open sourced and is available on Linux

#210
post #140
post #116

Earlier quoted context omitted.

> 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.

Well, yeah, but I mean the concept (grepping in tabular data). 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'…

ps aggregates /proc info for human viewing. Why grep the formatted output rather than the source data?
Post reply on HN