Live data from Hacker News

A language that compiles to Bash and Windows Batch

github.com

21–30 of 148 posts

Re: A language that compiles to Bash and Windows Batch

#21
post #6

Is there a way to get this as a precompiled Windows binary? I really want to give this a try, but I'm just sooo lazy and don't want to install OPAM if there's maybe a way around that.

If you just want to fool around there is a converter on the website.

Re: A language that compiles to Bash and Windows Batch

#22
post #10

Earlier quoted context omitted.

I don't think windows comes with python installation.

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

Re: A language that compiles to Bash and Windows Batch

#24
post #23

This is cool, but I hope the new Linux Subsystem in Windows 10 will propagate enough that everything can be written in bash

i will never understand why people fetishize that awful language.

It's significantly better than batch

Re: A language that compiles to Bash and Windows Batch

#25

The project hasn't been worked on in over a year also it isn't the language that is much different but the tools. Are you going to write grep on windows? If not the language really doesn't matter.

Agree, you have to be careful these days not to bet on a dead horse. Or healthy and promising initially, but swiftly dead. I don't know that I need grep on windows or other powerful nix tools to find value in this. I'm not going to get cross-platform powerful scripts, but I need some simple batch file on windows to something, and god forbid I need to loop or increment or something, I'd probably rather use Jim's home brew language than batch...cuz it's that painful.

Re: A language that compiles to Bash and Windows Batch

#27
Weird that it doesn't seem to support basename (1) and dirname (1) and their Windows equivalents (e.g. %~dp0%)

Quite a few of my scripts need to find files relative to the location of the script, or compute the path to an output file by replacing the extension of an input file.

Re: A language that compiles to Bash and Windows Batch

#28
post #24
post #23

Earlier quoted context omitted.

i will never understand why people fetishize that awful language.

It's significantly better than batch

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

#30
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

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 extension mechanism to make it easier to define such functions.
Post reply on HN