Live data from Hacker News

A language that compiles to Bash and Windows Batch

github.com

81–90 of 148 posts

Re: A language that compiles to Bash and Windows Batch

#82
post #59

I must have done it wrong. In the late 80s, I created a Windows batch-to-executable compiler called Builder (extending the language greatly, to the point of menus as language constructs). Made a decent living off it, too!

Consider posting in here then: https://news.ycombinator.com/item?id=11718197

Re: A language that compiles to Bash and Windows Batch

#83
post #69
post #3

You've got to admire this and at the same time you can't help but see the shadow of two more letters on the end of its name...

Don't script it. Batsh it!

I feel like it was created just to make this sentence possible. Love it!

Re: A language that compiles to Bash and Windows Batch

#84

How should I pronounce the name? I read “batsh” as a homophone for “batch” [bæʧ], which is unfortunate. Is it supposed to be pronounced as two syllables [bæɂ.ʃ] or something like that?

Pronounced "bath". The s is silent.

Re: A language that compiles to Bash and Windows Batch

#85
post #80

I am the author of Batsh. Batsh is a toy language I developed 2.5 years ago in a hackathon. It was just for me to play with OCaml. Feel free to play with it at http://batsh.org/ .

It's a pretty interesting idea, more so when developed under the context of of a hackathon. Where did the idea come from?

Re: A language that compiles to Bash and Windows Batch

#86

Earlier quoted context omitted.

Well sure, but these days PowerShell is what Windows people use for anything non-trivial.

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.

Re: A language that compiles to Bash and Windows Batch

#87
post #74

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.

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

Re: A language that compiles to Bash and Windows Batch

#88
post #30
post #22

Earlier quoted context omitted.

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

Batsh already has some built-in functions which are, i assume, implemented on top of equivalent commands on either platform - for example, readdir() is implemented on top of either ls or dir. It seems plausible that more could be implemented on top of other pairs like these - for example, a searchfile() on top of grep and findstr, impersonate() on top of sudo and runas, etc. Perhaps what it really needs is an extensi…

At least PowerShell has an ls alias for dir...

Re: A language that compiles to Bash and Windows Batch

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

It's not about can or can't I think. Examples: Language runtime can't be installed, system locked down with deepfreeze, not enough permissions..

Those aren't normally solved with scripting. However, any language with the ability to issue arbitrary system commands can accomplish everything a command line can.
Post reply on HN