Live data from Hacker News

A language that compiles to Bash and Windows Batch

github.com

141–148 of 148 posts

Re: A language that compiles to Bash and Windows Batch

#142
post #97

Earlier quoted context omitted.

Fresh machine where and for whom? I doubt a simple batch script will get you very far (setup.exe exists for a reason...), and I doubly-doubt you would have enough overlap in the process that something that can convert the steps to bash would be an advantage. The only advantage I see for batsh is that it looks nicer to write in for the tiny subset of batch it supports. But then so is pretty much anything else -- it wo…

Ok, I'll try another use case: Political differences (specifically licensing). This project appears to be licensed under MIT, and python appears to be licensed under !MIT. I don't know what the implications are for the licensing of machine-produced shell code, or binary versions of Python, but I'm sure there are companies out there that would have opinions to favour one alternative over the other for reasons other th…

Maybe. Python is under an MIT-like license, so you're fine, but if it were under e.g. the GPL you could still look to see if they have some form of runtime exception as GCC does. In any case it's rare for a company that's not well-established to care more about licensing that technical merit (and even any that do, the typical approach is to ask to buy a separate license if possible), and it's also rare that a company would use such a tool as this (created as a hackday project, in Ocaml, according to the author) rather than finding an alternative that meets their licensing criteria or just developing it in-house since it's not that big a tool and lacks a lot of useful capabilities like piping.

Re: A language that compiles to Bash and Windows Batch

#143

Earlier quoted context omitted.

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.

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.

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

#144

Earlier quoted context omitted.

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 ' ' 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}…

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.

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

#145

Earlier quoted context omitted.

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.

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

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

#146

Earlier quoted context omitted.

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.

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.

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

#147

Earlier quoted context omitted.

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.

I'd say the usage of -lt and the like is because angle brackets are used for piping data.

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

#148

Earlier quoted context omitted.

The attraction for me is not about portability, it's about having a better language to write CMD script. Even when you know you have Python available sometimes you still need to glue things together with CMD.

These days you probably want Windows Powershell. It's built on the .NET framework so it's pretty darn powerful and AFAIK is available by default on every modern WinOS.

Is there a linux or mac build of Powershell? After all this years hearing it is not that bad i would really love to try it a day or two
Post reply on HN