5 ms·
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 involv
by thinkpad20 10y ago
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, so once again the problem doesn't seem to be the language per se. I can only imagine how difficult it would be not just to design a script that would work properly on both platforms, but to debug the cases where it didn't.
Also, 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 :)
- badloginagain 10y agoI 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.
- stephengillie 10y agoPowershell 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 > file.html
- Hondor 10y agoIsn't that just what a compiled language would sort out for you? On Bash it'd compile to curl HTTP://example.com > file.html and on PowerShell it'd become (curl HTTP://example.com).Content > file.html
- niutech 10y agoThere is an "adapter" between PowerShell and Bash - Pash (http://pash.sourceforge.net http://pash.sourceforge.net)
- marshray 10y agoThe attraction for me is not about portability, it's about having a better language to write CMD script. Even when you know you have Python available sometimes you still need to glue things together with CMD.
- jheriko 10y ago> 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...
- Karunamon 10y agoIt's not about can or can't I think. Examples: Language runtime can't be installed, system locked down with deepfreeze, not enough permissions..
- tmuir 10y agoThose aren't normally solved with scripting. However, any language with the ability to issue arbitrary system commands can accomplish everything a command line can.
- choward 10y agoThen how will batsh get installed?
- ZoF 10y agoIsn't the entire premise of batsh that it compiles to bat? Why would you need to install batsh?
- robertelder 10y agoI don't use windows much anymore so there might be a better way to do this, but I'll propose a use case: Automating the installation of python on a fresh machine.
- speeder 10y agoI 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, or generate both). This software has my situation as the perfect use case, when you need to script command line tools that exist in both platforms.
- harigov 10y agoWhy can't you use the windows versions of bash?
- akie 10y agoIsn't that only available on Windows 10, and only very recently?
- uranusjr 10y agoThere have been many attempts to bring Bash to Windows before WSL. Git for Windows ships with a Bash port based on Msys (IIRC).
- be5invis 10y agoSo how to install it? Windows users are extremely lazy, they often just wait for a “click-and-run”.