News for hackers. Stuff that matters.
Re:A language that compiles to Bash and Windows Batch by criddell on Thursday May 19, 2016 @05:42PM (#11734108)
Well sure, but these days PowerShell is what Windows people use for anything non-trivial.
Re:A language that compiles to Bash and Windows Batch by voltagex_ on Thursday May 19, 2016 @08:57PM (#11734982)
Until your enterprise security people have a fit at something like PowerSploit [1] existing and turn on AllSigned via Group Policy. Then it's pretty much impossible to use PowerShell - edit, sign, test, edit, sign is quite painful with the current tooling (and that's even if you're "trusted" enough to get the codesigning cert). Not to mention that some of the scripts that Visual Studio uses aren't signed!

1: https://github.com/PowerShellMafia/PowerSploit

Re:A language that compiles to Bash and Windows Batch by wvenable on Thursday May 19, 2016 @06:24PM (#11734349)
PowerShell took everything that was great about .NET and combined it with everything that was terrible about Bash. So we have, yet again, a difficult to understand language for shell scripting.
Re:A language that compiles to Bash and Windows Batch by colejohnson66 on Thursday May 19, 2016 @07:49PM (#11734752)
Why is it bad? I've been able to write some pretty great PS scripts to automate tasks. It's easier than firing up Visual Studio and writing a C# program I'd need to recompile if I ever want to change it.
Re:A language that compiles to Bash and Windows Batch by wvenable on Friday May 20, 2016 @11:37AM (#11738682)
It's very powerful but the syntax is step back 20 years:

    If ($Number -gt 0) 
That's just one example. There is a lot of really confusing stuff in powershell that's entirely unnecessary. There were going for some kind of Bash-shell familiarity which, oddly enough, most Windows developers don't even have.
Re:A language that compiles to Bash and Windows Batch by colejohnson66 on Friday May 20, 2016 @06:31PM (#11742055)
I'd say the usage of -lt and the like is because angle brackets are used for piping data.
Re:A language that compiles to Bash and Windows Batch by wvenable on Friday May 20, 2016 @06:54PM (#11742185)
The shell is a mess of symbols making any sane programming language impossible. Instead of perhaps rethinking the "mess of symbols" issue they ruined the language instead.
Re:A language that compiles to Bash and Windows Batch by smoothdeveloper on Friday May 20, 2016 @03:29AM (#11736070)
Have you considered F#? Works well for scripting.
Re:A language that compiles to Bash and Windows Batch by gnaritas on Thursday May 19, 2016 @06:47PM (#11734457)
And PowerShell is an awful shell; it's great for script automation of windows, but as a shell, just no. Microsoft recognizes this, it's the reason a full Ubuntu bash shell is available in Windows 10.
Re:A language that compiles to Bash and Windows Batch by arthur2e5 on Thursday May 19, 2016 @07:30PM (#11734667)
> Microsoft recognizes this

MS also tried to improve PowerShell by installing the PSReadLine module by default.

Read https://github.com/lzybkr/PSReadLine for instructions on how to make PS a bit more usable.

Re:A language that compiles to Bash and Windows Batch by gnaritas on Thursday May 19, 2016 @10:43PM (#11735272)
The problem with PowerShell is its syntax, not the extra features of the shell environment. Trying to expose the .Net runtime to the command line is an admirable goal for a scripting language, not a shell. It comes down to this, PowerShell is a catherderal, bash and tools are a bizarre, and that's why they win IMHO. Personally the best shell for any Windows box is to install cygwin and treat it like a Linux box, and on Windows 10 just install Ubuntu and have a real Linux shell.

Windows servers are a dying breed and Microsoft knows it, they've lost that war and are quickly porting everything they can to run on Linux including their .Net runtime and Sql Server; they know they've lost the war, it's only a matter of time.

Re:A language that compiles to Bash and Windows Batch by criddell on Friday May 20, 2016 @09:57AM (#11737792)
Most of my big complaints about syntax are related to the shell-ness of PowerShell. For example, when comparing things, I really want to use '<' and '>' rather than -le and -gt.

Generally though, the syntax is different but once you learn it, it's mostly fine and sometimes the text-based nature of Unix commands means you have to do a lot more reg-exing.

For example, compare these two:

    ps -ef | grep "chrome" | awk '{print $2}' | xargs kill
vs

    ps -name chrome | kill 
Of course it's just a matter of preference, but I prefer the the PowerShell version.
Re:A language that compiles to Bash and Windows Batch by gnaritas on Friday May 20, 2016 @10:21AM (#11737970)
Um... pkill chrome, still prefer bash/gnu tools. The bazaar has far more tools, you just have to find the right one.

> and sometimes the text-based nature of Unix commands means you have to do a lot more reg-exing.

That's a feature that has far more upside than downside.

Re:A language that compiles to Bash and Windows Batch by criddell on Friday May 20, 2016 @01:00PM (#11739473)
I didn't know about pkill, thanks!

My point still stands. They are different but (IMHO) both excellent. Ubuntu on Windows may eventually reach parity with PowerShell but until then, PowerShell is worth knowing (especially if you follow Microsoft's advice and run servers without the GUI installed).

Re:A language that compiles to Bash and Windows Batch by gnaritas on Friday May 20, 2016 @01:59PM (#11740014)
I agree it's worth knowing, I just don't like it. My prefferred avenue will be porting all .Net stuff to Linux servers and just getting rid of all Windows servers as it becomes possible. .Net is great, C# is great, Windows isn't and I'm glad to see Microsoft's new CEO isn't blind to that reality.
Re:A language that compiles to Bash and Windows Batch by ComodoHacker on Friday May 20, 2016 @03:07AM (#11736012)
>bash and tools are a bizarre

You mean bazaar. Nice typo though.

Re:A language that compiles to Bash and Windows Batch by gnaritas on Friday May 20, 2016 @10:21AM (#11737974)
bah, yea, thanks.
Re:A language that compiles to Bash and Windows Batch by consto on Thursday May 19, 2016 @06:19PM (#11734327)
Really? I though PowerShell was designed primarily to replace cmd. Surely Windows people use actual programming languages for the majority of tasks with PowerShell/cmd for smaller scripting tasks.
Re:A language that compiles to Bash and Windows Batch by nopreserveroot on Thursday May 19, 2016 @05:54PM (#11734179)
It is significantly better than PowerShell.
Re:A language that compiles to Bash and Windows Batch by criddell on Thursday May 19, 2016 @06:24PM (#11734350)
and significantly worse too.