Earlier quoted context omitted.
Well sure, but these days PowerShell is what Windows people use for anything non-trivial.
It is significantly better than PowerShell.
A language that compiles to Bash and Windows Batch
51–60 of 148 posts
Re: A language that compiles to Bash and Windows Batch
#52 @echo off
set java=/usr/bin/java
that's not how it works. that's not how any of this works.Re: A language that compiles to Bash and Windows Batch
#53I've never tried but can't you already just run your node or ruby or whatever scripts on both Windows, Mac, Linux? Is there some reason targeting bash and batch is important?
Why not Python/Ruby/Node.js/Lua
Yes you can use any of them as platform-independent glue code. But there are several disadvantages:
None of them is preinstalled on all platforms (including Windows).
Functionalities like process piping are not convenient to use.
Hard to integrate with existing code written in Bash or Batch.
Those reasons are why I developed Batsh.Re: A language that compiles to Bash and Windows Batch
#54Weird 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.
However it does say "Batsh provided some "built-in" functions that will compile to platform-dependent code.". Arguably you could count basename and dirname under that.
Re: A language that compiles to Bash and Windows Batch
#55docker run -v %CD%:/opt -w /opt debian:jessie ./script.sh
Re: A language that compiles to Bash and Windows Batch
#56Re: A language that compiles to Bash and Windows Batch
#57Looks nice but wouldn't you just use something like Python nowadays?
I love python, but python is not a shell, and it makes an absolutely awful shell replacement. Python is further from a good shell than bash is from being a decent programming language. Some scripts are good, I do use python for some kinds of shell scripts, but most of what I need bash for, python is not a good replacement at all.
Re: A language that compiles to Bash and Windows Batch
#58Also, as others have noted this language doesn't support redirection, which in my mind makes it practically useless beyond toy applications. I've written hundreds of bash scripts and I don't think any of them didn't make heavy use of pipes and redirection. I'm also not sure if the language supports running processes in the background, traps, magic variables like $!, extra options, subshells, file globbing, etc, all things that many real-world scripts use. Bash scripts often use many programs available on Unix systems as well, such as find, grep, readlink, xargs, and other things that aren't part of the language per se. Unless those are ported over too, writing useful scripts would be almost impossible.
Finally, I don't think the author has made a convincing argument that such a language is even needed, when languages like perl/python/ruby exist for when the task is complex enough to require a more powerful language. On the other hand, if the project is (as I suspect) purely for fun and interest, then by all means :)
Re: A language that compiles to Bash and Windows Batch
#59Re: A language that compiles to Bash and Windows Batch
#60Earlier quoted context omitted.
It's significantly better than batch
Well sure, but these days PowerShell is what Windows people use for anything non-trivial.