A language that compiles to Bash and Windows Batch
131–140 of 148 posts
Re: A language that compiles to Bash and Windows Batch
#132I 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/ .
Re: A language that compiles to Bash and Windows Batch
#133Earlier quoted context omitted.
I think it's a limitation more on the windows batch end. As mentioned, it's tricky for historical reasons. Powershell would be closer to Bash, functionally speaking. An adapter between the two would be more functional- however doesn't satisfy the point of batsh, which assumes cleanish-builds of the OS in question.
Powershell introduces more complications, with functions like Invoke-WebRequest being given the alias "curl". At a minimum, you would get a type validation error, as Invoke-WebRequest by default gives back headers and other data as objects inside a larger object, not just the content string that curl.exe defaults to returning. This should work in both bash and PS, with different results: > curl HTTP://example.com > f…
curl HTTP://example.com > file.html
and on PowerShell it'd become
(curl HTTP://example.com).Content > file.html
Re: A language that compiles to Bash and Windows Batch
#134Earlier 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…
Generally though, the syntax is different but once you learn it, it's mostly fine and sometimes the text-based nature of Unix commands means you have to do a lot more reg-exing.
For example, compare these two:
ps -ef | grep "chrome" | awk '{print $2}' | xargs kill
vs ps -name chrome | kill
Of course it's just a matter of preference, but I prefer the the PowerShell version.Re: A language that compiles to Bash and Windows Batch
#135Earlier 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.
Re: A language that compiles to Bash and Windows Batch
#136Re: A language that compiles to Bash and Windows Batch
#137The 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 think it's a limitation more on the windows batch end. As mentioned, it's tricky for historical reasons. Powershell would be closer to Bash, functionally speaking. An adapter between the two would be more functional- however doesn't satisfy the point of batsh, which assumes cleanish-builds of the OS in question.
Re: A language that compiles to Bash and Windows Batch
#138Earlier quoted context omitted.
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…
Most of my big complaints about syntax are related to the shell-ness of PowerShell. For example, when comparing things, I really want to use ' ' rather than -le and -gt. Generally though, the syntax is different but once you learn it, it's mostly fine and sometimes the text-based nature of Unix commands means you have to do a lot more reg-exing. For example, compare these two: ps -ef | grep "chrome" | awk '{print $2}…
> and sometimes the text-based nature of Unix commands means you have to do a lot more reg-exing.
That's a feature that has far more upside than downside.
Re: A language that compiles to Bash and Windows Batch
#139Earlier quoted context omitted.
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
#140Earlier 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.