..and why wasn't this posted 2 weeks ago!
Batsh – A language that compiles to Bash and Windows Batch
81–90 of 130 posts
Re: Batsh – A language that compiles to Bash and Windows Batch
#82Re: Batsh – A language that compiles to Bash and Windows Batch
#83Could be great to have a compiler js -> bash / batch
Re: Batsh – A language that compiles to Bash and Windows Batch
#84Earlier quoted context omitted.
My initial thought after seeing this is Windows support is interesting, but the real value is in making bash friendlier. Something that brings syntactic sugar to bash is welcome in my mind, as I always find myself putzing with Google to find solutions to even slightly non-trivial scripts. Perhaps I should just master bash scripting once and for all (I know it's not that complex), but I generally find it unpleasant to…
Use Python? Most of the time I find myself struggling with Bash, it's because a simple script has kept expanding in scope and I'm well into the sunk-cost fallacy in trying to fix "just that one last thing". But unless you have a really specific environment, I'm pretty sure most modern servers probably have Python or Ruby or some other stack that can be a shell script available. If you're in Bash, it's because you wer…
Re: Batsh – A language that compiles to Bash and Windows Batch
#85Long ago I thought about writing something that compiles to batch files, if only to make complex logic a bit easier to write or make the process of thinking about every little syntactic idiosyncrasy less tedious. Since then I found PowerShell though, and the need of writing complex and sophisticated batch files isn't so much there anymore¹. Nice to see this compiler adopting some idioms that make it easier for workin…
I recently wrote a batch script just to make sure it'd run on any Windows system rather than risk powershell. If it was always going to run in a controlled environment, I'd have written it in cygwin bash anyway.
Re: Batsh – A language that compiles to Bash and Windows Batch
#86Long ago I thought about writing something that compiles to batch files, if only to make complex logic a bit easier to write or make the process of thinking about every little syntactic idiosyncrasy less tedious. Since then I found PowerShell though, and the need of writing complex and sophisticated batch files isn't so much there anymore¹. Nice to see this compiler adopting some idioms that make it easier for workin…
The main issue with powershell is portability - no guarantee that someone's Windows box will have it installed or not. I recently wrote a batch script just to make sure it'd run on any Windows system rather than risk powershell. If it was always going to run in a controlled environment, I'd have written it in cygwin bash anyway.
powershell -ExecutionPolicy Bypass -NoProfile -File %~dp0.ps1 %*
That's what I usually do, which is also helpful for colleagues who have no idea how to run a PowerShell script because just double-clicking it doesn't work.Often I start with a batch file, just to notice after a dozen lines that this sort of thing is much easier to write and maintain in another language. And in the last two years I shifted more to PowerShell than batch in many cases. Some of that is surely due to atrocities like Windows XP dying out and Vista never being common. For scripts that developers execute on their machines PowerShell should be a fairly safe bet in a Windows environment by now. Deployment or build scripts should probably be MSBuild or something similar.
Re: Batsh – A language that compiles to Bash and Windows Batch
#87Re: Batsh – A language that compiles to Bash and Windows Batch
#88Re: Batsh – A language that compiles to Bash and Windows Batch
#891. From UNIX point-of-view, not all has the luxury of bash, so seems to be quite limited to a certain modern platform? I found out ksh are more prevalent 2. I actually use UnxUtils in windows so I can has POSIX command option (and scripting). Performance-wise, never tested as not needed, all short command / simple script
If you're referring to Linux as "certain modern platform", I was using bash on Solaris 1.x 20+ years ago. (Granted, back then I had to compile it myself which may not be an option for many.)
Re: Batsh – A language that compiles to Bash and Windows Batch
#90Was discouraged at it being OCaml, but because you made it web based so it's accessible to everyone, you win a free internet.