Live data from Hacker News

PowerShell is open sourced and is available on Linux

azure.microsoft.com

571–580 of 790 posts

Re: PowerShell is open sourced and is available on Linux

#571
post #93

Earlier quoted context omitted.

As a note, there have been strongly-typed shell languages for Unix for some time. Scheme Shell[0], Turtle[1] and TCSH[2] leap to mind; but there's nothing preventing a developer from using Perl, Python, Lisp or any other language that allows itself to accept stdin as an interpreted script. 0: https://scsh.net/ 1: http://www.haskellforall.com/2015/01/use-haskell-for-shell-s... 2: http://www.tcsh.org/Welcome Edit: oh m…

I've been loving using Node.js for scripts. You get all the NPM goodies plus STDIO, and they end up working just as well as shell scripts. One of the big advantages IMO is that I only need to master one language for all of my needs, from browser to server to shell :)

Pure madness. I'm sure this is how elated the architects of the Tower of Babbel felt about themselves right before the crash.

Re: PowerShell is open sourced and is available on Linux

#572

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 sorely needs an && and a &

Re: PowerShell is open sourced and is available on Linux

#573

Earlier quoted context omitted.

I did, and i found it a pretty big chore in practice. Its two modes (shell mode and python mode), never quite knowing which one you're in, I could never quite get used to that. PowerShell doesn't have this problem, because it was designed for the command line first and for scripts second (which is, incidentally, also its major downside if you ask me).

> Its two modes (shell mode and python mode), never quite knowing which one you're in, I could never quite get used to that. Drive-by armchair comment: it seems like the obvious answer would be to change the prompt depending on what mode you're in?

I find this criticism of xonsh's "modes" baffling. Xonsh is brilliant precisely because it isn't modal the way, e.g., vi is.

Xonsh lets you freely mix python code and command invocations in a highly transparent way.

Re: PowerShell is open sourced and is available on Linux

#574
post #256
post #32

Earlier quoted context omitted.

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…

Could you elaborate on what the actual complexity is, rather than what you imagine? For a developer writing a tool, exposing an interface as objects is far easier than having to constantly serialize data into a string. Keep in mind that once you serialize data into a string, you can never change the order of the data or else other tools will break. Not so with a object based interface. In other system-admin type task…

And how to delete files older 2 days? Get-Files / | select olderThan 2 | Delete-File ?

But it's not bash, it's coreutils

  find ./ -mtime +2 | xargs rm

Re: PowerShell is open sourced and is available on Linux

#575
post #529

Earlier quoted context omitted.

I wouldn't go so far as to call it a "horrible abortion" - but it can be painful to use at times. I manage several Azure environments with PowerShell and not a day goes by that I don't wish there was something better. Especially on those days when I have to dig into Azure's JSON templates. There is an SDK for Python, but I haven't had an opportunity to try it. If anyone has used it I would love to hear about your exp…

There are the Azure REST APIs that you can curl. Or the Azure-CLI on Linux and Windows. That said, I've noticed that powershell seems to get priority with Azure support before the azure-Cli client, so there are a few gaps here and there. I've been told that the Azure REST APIs are all in step with Powershell support, but sometimes go in documented unfortunately.

To be honest, I prefer PS to the Azure CLI but I have had to resort to the CLI on a couple of occasions. If I remember correctly it was to reset credentials on a VM (which wasn't possible with PS at the time). I guess the main problem with the CLI is that it's not a shell or a general purpose programming language.

The Azure REST API requires a ton of deeply nested JSON data structures. Take a look at this [1] sample. I just can't bring myself to work with that every day.

I really need to buckle down and try that python API.

[1] https://msdn.microsoft.com/en-us/library/azure/mt163591.aspx

Re: PowerShell is open sourced and is available on Linux

#576

PowerShell 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…

It's junk. Tried to get something useful done and version incompatibilites and poor documentation made it a losing battle. Type theory is over-wrought for getting things done. My boss doesn't care that I have to cast an integer to a string.

Re: PowerShell is open sourced and is available on Linux

#577

Earlier quoted context omitted.

And either the "ip" command can never change how it formats its output, or your script with that command will break some day.

...Which is why I said it was ugly. The grep probably won't break, the cut is more likely to. This is in part because the 'ip' command isn't very well designed. A better solution I found is ip addr show wlan0 | grep -Po 'inet \K[\d.]+' Which is less likely to break. If your system supports it, hostname -I Works great. However, this seems to be an ubuntuism, and it doesn't work on my system.

  ip addr show eth0 | awk '/inet/ { print $2 }'
Will be better ;) 'inet[::space::] ' not working with ipv6 addresses.

Re: PowerShell is open sourced and is available on Linux

#578

Earlier quoted context omitted.

It looks like they're a little different for now. See the note under here. https://msdn.microsoft.com/en-us/windows/uwp/get-started/ena... Full Disclosure: I am a MSFT employee.

More specifically, I don't want to SSH from a Windows box. I want to SSH into a Windows box (and say figure out a way to easily install a LE cert)

There have been ssh servers for windows since forever.

Re: PowerShell is open sourced and is available on Linux

#579

Earlier quoted context omitted.

Exactly. The developers they can get to work for them are "useful idiots", whose work they then use to further screw over their main customers, who aren't going to abandon them no matter what, and also bring in more developers to their platform and away from the competition. As long as these developers are easily and naively wooed by a bunch of BS talk about "the new Microsoft", they get to help MS with their evil sh…

Sigh. I don't even know how to start with this one. I'm a "useful idiot" because I'm interested in making PowerShell work as a proper Debian package, or because I might look into what's required to get it into FreeBSD? Seriously? MS is not a monolith, it's made up of lots of different people with different ideologies and different goals.

I think the parent comment's point, with which you are likely to disagree but haven't fully addressed, is that even the best intentions of developers can only serve the ends of the less noble segments of Microsoft.

Re: PowerShell is open sourced and is available on Linux

#580
post #510

Earlier quoted context omitted.

Does tmux work well on Windows? Everything Microsoft has been doing recently with bash on Windows has made me consider buying a surface pro as my next machine.

I was a big GNU Screen user on linux, which unfortunately doesn't work on WSL. So I tried tmux, and it works fine for the few minutes I tried it: Create new tabs, detach session, etc. But once you close the Bash primary window, the session dies, so it's not as persistent as running tmux on a Linux machine, which makes sense given how WSL works. I haven't figured out yet if there is a way to always keep WSL running in…

Execute tmux as a scheduled task.
Post reply on HN