Live data from Hacker News

A language that compiles to Bash and Windows Batch

github.com

121–130 of 148 posts

Re: A language that compiles to Bash and Windows Batch

#122

Earlier quoted context omitted.

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

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…

>bash and tools are a bizarre

You mean bazaar. Nice typo though.

Re: A language that compiles to Bash and Windows Batch

#123
post #22
post #10

Earlier quoted context omitted.

It also doesn't come with any of the tools bash is a glue for, about the only reason one uses bash. At least with Python I can write my own grep and so on, and piping isn't so bad with coroutines and generators.

Windows has knock-off versions of several unix tools: grep = findstr cat = type which = where sort = sort more = more sudo = runas

And no less!

I didn't know about where, being Windows "native". Thank you.

Re: A language that compiles to Bash and Windows Batch

#124

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.

Have you considered F#? Works well for scripting.

Re: A language that compiles to Bash and Windows Batch

#125

Earlier quoted context omitted.

I loved the idea. Some years ago, I was making a project that many parts of the build process depended on simple file copies (that this can do right) and ImageMagik calls (that are the same in all OSes) I ended having to keep writing the same scripts over and over again in Batch and Bash, it was quite a pain to maintain, and it was obvious that there had to be some way to do it automatically (port one to the other, o…

Why can't you use the windows versions of bash?

So how to install it? Windows users are extremely lazy, they often just wait for a “click-and-run”.

Re: A language that compiles to Bash and Windows Batch

#126
post #74

Earlier quoted context omitted.

> sometimes you still need to glue things together with CMD why? is there something cmd can do that python can't? one example is enough...

I don't use windows much anymore so there might be a better way to do this, but I'll propose a use case: Automating the installation of python on a fresh machine.

In that case you would use the chocolatey package manager bootstrapped by powershell to silently install Python.

It's a oneliner in powershell followed by choco install Python.

Re: A language that compiles to Bash and Windows Batch

#127
post #95
post #93

Earlier quoted context omitted.

How are you going to install batsh though?

you don't need to install batsh. you maintain your code in batsh, compile to bat and have that up on your page as a download.

Even if you did distribute bat files online Windows would block downloading or running them by default so they are not a useful method.

Re: A language that compiles to Bash and Windows Batch

#128
post #93

Earlier quoted context omitted.

I don't use windows much anymore so there might be a better way to do this, but I'll propose a use case: Automating the installation of python on a fresh machine.

How are you going to install batsh though?

You generate bat and sh files during the build, like deb or exe files.

Re: A language that compiles to Bash and Windows Batch

#129
A couple of slight nitpicks, but isn't this more like a translator? I understand a "compiler" to be that which condenses high-level structures down to more fundamental CPU-oriented structures (as opposed to an "interpreter" that takes the structures as presented). If you're compiling into Bash, or windows batch then you're converting from one high-level representation into another. Though you could debate whether these are "high level" whether they are technically or not. I will concede that this batsh language does indeed look a lot nicer than either - it seems to be of the "general purpose" style of C or Javascript rather than the more targeted style of either bash or batch - which is specifically for the domain of operating system scripting - I guess this might mean it's actually lower level. The whole thing is pretty cool though :-)
Post reply on HN