3 ms·
New Programming Langauge Makes Bash Scripting Easier
- superzamp 2y ago[flagged]
- deleted 2y ago[deleted]
- ambyra 2y agoWould be nice if there was a Lua or Python/language subset version of this, and it could be run without needing to manually convert to bash first.
- cardanome 2y agoPython and Lua are already well suited for the typical scripting tasks (plus there is good old Perl). And I would actually recommend them for any non-trivial scripts as the maintenance is so much easier. I guess the selling point of Amber is the fact it compiles Bash so you can sneakily start using it without having to argue with your co-workers whether language X should be allowed in the code base. Plus, no worrying about having the right Python version installed. Though then again I am not sure the compiled bash is very idiomatic so probably still not easy to get into code review.
- jasonpeacock 2y agoAlas, you still have to worry about having the right Bash installed :( For example, OSX (still) ships with Bash 3.x as the default, while many Linux distros have Bash 4.x, and the latest Bash is 5.x.
- ohples 2y ago> Python and Lua are already well suited for the typical scripting tasks (plus there is good old Perl). And I would actually recommend them for any non-trivial scripts as the maintenance is so much easier. I have some personal rules of thumb/guidlines around this, if a bash script does any of the follow it should be put on the docket to be converted to a Python script/app: - a nested for loop with more then one level of nesting. - anything involving arrays/list. - anything involving json beyond simple queries. - more then 5 functions.
- 0cf8612b2e1e 2y agoI have a much simpler heuristic. More than five lines of work: use a real language. There are just too many bash foot guns to do anything more sophisticated than pipe one executable into another.
- pvg 2y agoRecent big thread https://news.ycombinator.com/item?id=40431835 https://news.ycombinator.com/item?id=40431835
- deleted 2y ago[deleted]
- Taikonerd 2y agoOils is a different approach to this - the base “OSH” language is pretty much identical to bash, and then you can incrementally opt in to more checks and QOL improvements. The key selling point is that you never have to totally rewrite your existing bash scripts - there’s an incremental upgrade path. https://www.oilshell.org/ https://www.oilshell.org/
- edward28 2y agoShould have called it bash++
- karmakaze 2y ago> Amber is designed based on the ECMA script syntax. ECMA aims to standardize the syntax for general-purpose scripting languages. This way, you get a familiar syntax across various scripting languages that adhere to ECMA syntax. I didn't know that ECMAScript had such lofty goals. Would TypeScript make sense to use? I'm used to having types everywhere but I'm sure many (especially coming from bash) wouldn't. To me it feels like trading one set of idiosyncrasies for another (or a combination) and we've been warned: > This project is in the early stages of development with only an alpha release at the moment. Experiment with it if you want but don't use it in a production environment.
- peggydfluent 2y ago[flagged]
- xenjimmy 2y ago[dead]
- USERt 2y ago[dead]