Live data from Hacker News

A language that compiles to Bash and Windows Batch

github.com

111–120 of 148 posts

Re: A language that compiles to Bash and Windows Batch

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

Who cares if Python can technically do it? If you have a CLI tool based around Bash, why would you want to rewrite it in Python and have to support it yourself and spend those man hours doing it?

Because then you wouldn't have to write in Bash...

Re: A language that compiles to Bash and Windows Batch

#112

Earlier quoted context omitted.

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.

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

#113

The idea is interesting, but ultimately the utility of this seems limited. The differences between windows and Unix are more than just the shell language involved; shell scripts are typically deeply intertwined with the system in question, to the point where it's often not the case that a bash script will even run reliably across different Unix systems, much less on windows. Also, you can already run bash on windows,…

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?

Re: A language that compiles to Bash and Windows Batch

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

Who cares if Python can technically do it? If you have a CLI tool based around Bash, why would you want to rewrite it in Python and have to support it yourself and spend those man hours doing it?

The context of this article and all of these comments is writing new scripts, not rewriting old scripts. If you have a completed script that does everything you want, then none of this applies.

Re: A language that compiles to Bash and Windows Batch

#115
post #2

Looks nice but wouldn't you just use something like Python nowadays?

What if you want to build Python? Oh, that' easy, you unpack the Python sources and start with: ./configure But what is that? It's not written in Python. It can't be, because you don't have Python yet. It's a shell script. It's not a hand-maintained shell script; it's written by expanding Autoconf macros (in the M4 preprocessing language) to shell code: essentially a compiler from another language to shell. A cleaner…

Writing your language's build system in itself shouldn't be any worse than writing your language's compiler in itself.

The GHC folks are rewriting their jungle of recursive Makefiles in Shake, a Haskell-based build system.

I think you only need the ability to build a cross compiler for this to work.

Re: A language that compiles to Bash and Windows Batch

#116

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?

Isn't that only available on Windows 10, and only very recently?

Re: A language that compiles to Bash and Windows Batch

#117
I like the idea of compiling to bash from a much saner language even without Windows compatibility. With containers and slimmed-down OS like CoreOS Python and friends may not be available. Besides, for some tasks Python startup time is just unacceptable so using Bash could be a good option if not the awkward syntax to put it mildly.

Re: A language that compiles to Bash and Windows Batch

#118
post #111

Earlier quoted context omitted.

Who cares if Python can technically do it? If you have a CLI tool based around Bash, why would you want to rewrite it in Python and have to support it yourself and spend those man hours doing it?

Because then you wouldn't have to write in Bash...

Or BAT. I can live (reluctantly) with Bash, but Windows batch file is just brutal.

Re: A language that compiles to Bash and Windows Batch

#119
post #116

Earlier quoted context omitted.

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

Isn't that only available on Windows 10, and only very recently?

There have been many attempts to bring Bash to Windows before WSL. Git for Windows ships with a Bash port based on Msys (IIRC).

Re: A language that compiles to Bash and Windows Batch

#120
post #110

Earlier quoted context omitted.

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.

Powershell _is_ great (I help run an OSS project written in Powershell), but it has a long start-up time. If you're doing it as a pre-build step for example, you don't want to add potentially seconds (!) to your build just to use powershell.

Do you use -noprofile? (you probably should for build steps, or else make sure all your build environments have a similar profile to yours) Then the startup time is usually much better - at least I haven't seen it going over some 100s of mSec.
Post reply on HN