Earlier quoted context omitted.
Why doesn’t Amber have equivalent issues? Such as depending on a specific version of bash, or specific executables to be installed. Also does bash run on windows outside of WSL? Amber seems to argue that it doesn’t support Windows because Windows doesn’t support bash. That would cut against the idea that bash can target more devices than Python, which runs natively on all platforms.
Amber doesn't have equivalent issues because bash and the utilities it uses like bc and sed are incredibly stable. I've found nontrivial shell scripts I wrote decades ago that still run entirely unchanged.
Amber: Programming language compiled to Bash
251–260 of 330 posts
Re: Amber: Programming language compiled to Bash
#252But imagine you need to deploy a server but for whatever reason you can't use Puppet, Ansible, or other configuration management tools. You need to write a deployment script using a "real" programming language.
How would you tackle the problem using Go, for example? Does anyone have examples of deployment or install scripts written in Go, Rust, or whatever else?
Thinking out loud I assume you would need a zypper (assuming openSUSE) package with Repository and Package structs and their methods, a secrets package to handle getting secrets from your secrets manager and setting them, and I'm drawing a blank on everything else.
As a system admin I picked up Go a few months ago to slowly reduce my Bash usage, but I still find myself using Bash whenever I have to write a install script because of how easy and fast it's to write compared to other languages.
Re: Amber: Programming language compiled to Bash
#253I wish there was a solution for something like Download(file.gz) and that gets converted to either a wget or curl based on what the system has.
dl_tool=$(command -v curl || command -v wget)
if [[ ${dl_tool} == *curl* ]]; then
dl_cmd="${dl_tool} -sLO $1"
elif [[ ${dl_tool} == *wget* ]]; then
dl_cmd="${dl_tool} -q $1"
else
printf "%s\n" "ERROR: curl and wget not available, exiting"
fi
Can easily be turned into a function.Re: Amber: Programming language compiled to Bash
#254Earlier quoted context omitted.
> Just learn bash. There are many reasons why it is to be avoided. For me the deal breaker was that one time I spent 2h debugging a script only to find out there was an extra space character that made the whole thing break silently. I would be willing to learn a sane language, but bash isn't one. If you need to know of a million tiny gotchas to implement even the simplest task safely and portably, then there isn't an…
> need to know of a million tiny gotchas to implement even the simplest task safely and portably While this is clearly exaggeration, I'm not sure I find much merit in the argument. C is full of gotchas, footguns, and a tremendous threat vector. But it is also the standard for many uses. Yes, bash has legacy cruft, and potentially confusing ways of doing things. But for the realm in which it operates, it is extremely…
(I'm not GP)
Yes, and the same way there's a plethora of bash-alternatives in the making, there are multiple languages trying to essentially be a "better C", such as Go, Rust and so on, not to mention C++ and its descendants.
I definitely think there's room for an improved bash. The biggest question is whether an alternative can become ubiquitous enough to be a fully qualified alternative.
Re: Amber: Programming language compiled to Bash
#255Re: Amber: Programming language compiled to Bash
#256Earlier quoted context omitted.
No, because you don't need to install Amber, and bc and sed are pretty much guaranteed to be installed already if bash is.
GitBash (MinGW) doesn't ship with bc or dc, but it does ship with awk.
Re: Amber: Programming language compiled to Bash
#257I love the concept of a language like this, though I haven't evaluated amber in detail. I want to do more complex things using bash for devops stuff, because it's mostly working with other command line tools. You could directly use APIs and SDKs of cloud providers, but then things become an order of magnitude more complex than just writing the bash script. However, when you do that you encounter bash's weaknesses, li…
I sort of see that, but at the same time why not just compile to python instead? I get that python can be less convenient syntactically for "scripting" type things, but if you're writing in what's effectively a DSL that gets transpiled for a different interpreter anyway...
Re: Amber: Programming language compiled to Bash
#258Earlier quoted context omitted.
> Just learn bash. There are many reasons why it is to be avoided. For me the deal breaker was that one time I spent 2h debugging a script only to find out there was an extra space character that made the whole thing break silently. I would be willing to learn a sane language, but bash isn't one. If you need to know of a million tiny gotchas to implement even the simplest task safely and portably, then there isn't an…
> need to know of a million tiny gotchas to implement even the simplest task safely and portably While this is clearly exaggeration, I'm not sure I find much merit in the argument. C is full of gotchas, footguns, and a tremendous threat vector. But it is also the standard for many uses. Yes, bash has legacy cruft, and potentially confusing ways of doing things. But for the realm in which it operates, it is extremely…
The majority of people doing DevOpsey kind of stuff aren't remotely experts with what they're working on, and won't ever be experts, but work still needs to get done.
Re: Amber: Programming language compiled to Bash
#259Slightly off-topic, but in many posts mentioning Bash, the overall consensus seems to be that when a script gets too big you should switch to using a more full-featured programming language instead. Which is fine, I get the reasoning. But imagine you need to deploy a server but for whatever reason you can't use Puppet, Ansible, or other configuration management tools. You need to write a deployment script using a "re…
Of course the disadvantage is that you need to Go have the toolchain installed everywhere you want to use the Go script, so it's definitely not as portable as using a regular shell script.
Re: Amber: Programming language compiled to Bash
#260We got some great BASH alternatives: Zsh, Fish, Elvish, Nushell, Xonsh. I did not evaluate them all, but if Amber is even better, why not have Ambersh?
Can somebody please explain?