3 ms·
Would 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.
by ambyra 2y ago
Would 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.