Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why would someone need to compile to bash.. how about just use python instead


You certainly should. Even if you know some bash and zero python I suppose, because bash is just so "special".

But only if your target environment has python, and that's not a given, not a zero-cost change, in this age of short-lived containers. The use case for a "compile to bash" language would be compile in a dev-operated environment and commit both source and output, which would then run on later stages in the CI/CD pipeline that might very well not have python. And those stages will absolutely not have your "compile to bash" tool, which would ideally be included along with the source unless it's somehow as near-omnipresent as python. This one appears to be implemented in rust, I'd certainly feel more optimistic about depending on it as a script authoring tool if it was e.g. a python script that could be included with my "pre-bash" source, and/or packaged in, say, npm.


I had done a SQL-like ->Bash "language," and the reason was that I wanted to have access to CLI tools as-is, in my case, curl programs. Had I chosen Python as a target, I'd have to use requests/urllib, which would be much more verbose.

The same applies if one needs awk, sed, etc... The constructs are just there.

Also the fact that you can just pipe to bash, makes development much easier.


And enjoy a mad scramble to rewrite everything after Python 4 releases?

For all its faults, after a Bash script works once, it usually just keeps working.


Python isn't nearly as likely to be installed already as Bash is.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: