Retr0id
Bash is nice, but if we're going to all the effort of transpilation, I'd really like to see plain POSIX sh as the target
omoikane
Assuming that these are typical outputs from Amber:

https://github.com/Ph0enixKM/Amber/blob/master/setup/install...

https://github.com/Ph0enixKM/Amber/blob/master/setup/uninsta...

The inconsistent indents and decorated variable names made them less readable than hand-written Bash scripts. I understand that most compiler outputs are not meant to be human readable, but generally we would get minification and/or obfuscation in exchange for losing readability, and Amber doesn't seem to offer those yet.

graypegg
I kind of wish this was a tool to author bash, or better yet very compatible POSIX sh. (versus being using bash as a compile target that a human isn't meant to read)

It's a bit of a stretch, but comparing it to something like MJML for HTML emails. [0] It doesn't make great HTML, but it's not unreadable and standard quality for HTML emails. It just handles all of the weird things you have to consider for maximum email client compatibility. It's basically a bunch of HTML macros, with react being an implementation detail under the hood. It's not like it's bringing any new features to HTML emails, because if it did, the output WOULD be unreadable.

If this was just some type hints, and cleaner syntax around sh, that I think would be really useful. This in it's current state is just sort of a tech debt generating machine. If something is built in amber, it's because we can only use bash for some reason, but if we can use bash we could either... use bash, or we could call something else (Ruby, Python, etc), from a 2 line bash script.

[0] https://mjml.io/try-it-live (click "View HTML" to see outputted source.)

Edit: Idea, it would be cool if you could define the environment available to the final script when using the compiler. That way, if there was something you wanted to distribute, the person building your project could say "this docker container I'm running this in won't have sed, but it will have bc and awk" or something.

carlinigraphy
To my eye, this does not look good.

I consider myself to be quite proficient in bash. I write a lot of bash professionally. I've written a compiler (transpiler?) for a strongly typed configuration language that outputs bash.

There are three main problems I see here.

(1) Pipelines, subshells, and external dependencies.

The example on the website compiles a conditional `if age < 18` into this monstrosity:

    if [ $(echo ${__0_age} '<' 18 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ]
Pipelines and subshells are "slow". Not tremendously. But it adds up. Also, what's the point of having types in your language if you're not going to use native arithmetic when applicable:

    if (( __0_age < 18 ))
Perfectly fine to alert users that floats will require an external dependency (such as dc), but integers will be handled in native arithmetic contexts.

Seems mildly insane that a conditional this simple would require a pipeline including `echo`, `bc`, and `sed`. Now the user needs to ensure the correct external CLI tools are installed, and match the expected versions. Hope they account for BSD vs. GNU variants. Eek.

(2) Namerefs.

> Arrays cannot be nested due to the Bash limitations

Arrays absolutely can be nested... with some trickery. Consider:

    # Top level array w/ pointers to children.
    declare -a arr1=( arr2  arr3 )

    # Child arrays.
    declare -a arr2=( item1  item2 )
    declare -a arr3=( item3  item4 )

    for ref in "${arr1[@]}" ; do
       declare -n sub_array="$ref"
       printf '%s\n' "${sub_array[@]}"
    done
The `declare -n` line is where the magic happens: https://www.gnu.org/software/bash/manual/html_node/Shell-Par...

This is a fairly trivial operation that I'd assume the authors would know about. It's fast and allows for the creation of arbitrarily complex objects. Even rudimentary classes.

(3) Just learn bash.

I'm perpetually confused by people taking every opportunity to not just... learn bash. An otherwise skilled programmer will somehow forget everything they've learned when beginning a shell script.

Surely it can't be harder to learn the fundamentals of shell scripting than to learn whatever flavor-of-the-month alternative is?

ephimetheus
I was hoping for a solid way to handle subprocesses, and especially how to handle failures. They have something in the docs, but it seems a bit underwhelming, in terms of how status codes and failures are handled. It’s probably better than straight bash, but I feel like there’s more to be done here.

Also: I don’t see mentioned how pipes affect the exit code propagation (i.e. pipefail).

spooneybarger
I was confused by Amber Smalltalk's pivot. Turns out it is just a newer language deciding to use the same name as an existing one. The domain is almost exactly the same as well.

https://amber-lang.net/

supriyo-biswas
I 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, like not supporting a nested structure like Map<String, Map<String, Int>> and so on. Having to wrangle tools like jq, sed and awk all together to work around the lack of proper data structures and string manipulation is no fun either.

Something like amber could bridge the gap while still being portable across systems.

rbren
I had a brief idea for transpiling bash here: https://github.com/rbren/baml

The thing I'm most proud of is the installation--you just put a single base64 encoded line at the top of your script, and everything works magically.

poikroequ
This looks very promising! I've been wanting something like this for years, a nicer shell scripting language which compiles to Bash so I can run it almost everywhere. I don't think Amber is not quite there yet, missing some pretty essential shell features, but is off to great start. I'll be keeping an eye on this.

Maybe this is still early in development, but I don't see anything for pipes or redirection. Is this a planned feature? That's an essential feature of any shell and I can't see myself getting much done in Amber without it, especially pipes.

I suggest adding more examples to the home page, especially side by side comparisons with Bash. The home page is somewhat lacking in content right now.

LectronPusher
I haven't seen a mention of the Oil Shell (https://oilshell.org) project's OSH/YSH yet and I'm quite surprised.

Oils goal is that OSH is just a new Bash implementation (although not bug-for-bug) but with an upgrade-path to the more modern YSH for real programming with type safety etc, but still as a shell language. One of their exciting ideas is using code as data in a somewhat lisp-like manner to allow function introspection in YSH etc.

Based on other comments it seems like Oil Shell is much more principled in working to actually understand Bash as it exists and presenting an alternative language. I would be interested in what differentiates Amber and whether they have a response to Oils?

manlobster
I don't love the $...$ syntax for executing commands. Using $ as a string delimiter is very strange to my bash-accustomed eyes.

It's a shame that they provided such weird syntax for the most important thing you tend to do in a bash script, while providing fairly nice syntax for everything else.

vhmc41
I was really confused because there's also a Amber Language that compiles to JS: https://amber-lang.net/
leni536
I like the idea, but the example suggests that it invokes external programs for trivial stuff, like comparing a variable to an integer (invokes bc and sed). I would prefer if it compiled to pure bash, and only invoked external programs if explicitly called for. But I guess emulating some feature in pure bash is hellish, that's exactly I don't want to write that manually either though.
jordemort
I think this is a pretty interesting idea. I could see myself using this on one of my previous embedded jobs; we needed to stuff a bunch of complex logic into our initramfs and the only interpreter we could really fit in there was the sh from busybox. We ended up with a pretty hairy shell script that probably would have been nicer to write in Amber.
burky
This looks similar to a tool I discovered a while back called Batsh. But Amber looks a lot more polished and has some nice safety about it.

https://github.com/batsh-dev-team/Batsh

bogwog
This is interesting, but I don't see why I would use this instead of Python or Go? With those I'd get portability, modern features, etc but with the added bonus of a powerful standard library and ecosystem.

Don't get me wrong, I hate writing shell scripts, so this is definitely an improvement over that. It just doesn't seem like the most practical solution (unless I'm missing something).

michaelmior
> Variable declarations can be overshadowed - this means that you can redeclare the existing variable with different data type in given scope if you need to.

I'm having a hard time deciding why I would want this. It seems more likely to result in bugs than being a useful feature.

fforflo
I don't share the "oh my, why bash, why not English then?" sentiment in the comments.

I've done a bunch of DSLs (CLI with some elaborate syntax really) that compile to bash as a target. It just works for me. Bash is always available; the constructs you can use are there (coreutils are mostly enough for the primitives and xargs for parallelization) It has been great so far for basic cases. Where things get complex (as other's have said) is handling failures, errors and intrinsic cases. That's when you're reminded why people didn't stuck with bash in the first place and we got other scripting languages.

viraptor
I wish nushell had a similar compiler. It would help with using it on servers.
anonu
Maybe I lack a bit in creativity: but what purpose does this serve? Almost all machines have a python or even perl interpreter if you really need to go there.
saurik
Something I noticed when I went to copy/paste something off the web page for this comment: at least some of the text on this page is in the form of an SVG?! That just feels gratuitous to me, particularly given how annoying it is to not be able to copy it :/.

https://amber-lang.com/pipelines/compile.svg

It also, hilariously, feels a bit fitting given my actual complaint ;P.

    if [ $(echo ${__0_age} '<' 18 | bc -l | sed '/\./ s/\.\{0,1\}0\{1,\}$//') != 0 ];
Look: I appreciate that this is a shell script, and they often aren't "fast", but if I'm writing code in a script and have a comparison it at least might be in some tight loop and the performance different of spawning bc and sed into a subshell is frankly brutal.

    if [ "${__0_age}" -lt 18 ]; then
philmitchell47
Seems horrendously brittle. I'd trust badly written bash over this.
slushy-chivalry
I think a superset of bash with strong types makes more sense than a brand new language that compiles to it. This is what makes typescript so successful (aside from other things) is that you can just drop it into your project and incrementally adopt it.
DemocracyFTW2
> In Amber, there is a rule that allows you to use a : symbol where you intend to write only one statement, wherever you can write a block of code. This can be handy when you want to perform multiple conditions with a single statement each.

This feature, optional omission of delimiters in the special case of a single statement per branch, originated in early C and has since facilitated untold numbers of bugs, not least the spectacular Heartbleed bug (which has its own homepage, https://heartbleed.com).

adamtaylor_13
I love the idea, but having spent so much time learning the ins and outs of bash I feel like I’d rather just use bash. To say nothing of the Lindy Effect. Bash will probably be here in 50 years. This probably will not.
phaedryx
Groxx
This is equal parts horrifying and impressive and useful.

I'm unsure how to feel.

lifeofguenter
Impressive project.

But I always feel that if you reach a certain complexity in your bash scripts, you should rather pivot to any other $lang.

Bash scripts should be simple glue between programs (unix-principle).

HKH2
Rust, except using existing executables (or dynamic libraries) instead of downloading packages and waiting ages for it to compile? Seems like a great idea.
gmdrd
There is a typo in the docs:

    Notice that when executing a single expression, Amber automatically includes it's standard library for you.
wavemode
I can't envision a circumstance where I would use this over perl. Every Unix system under the sun has perl. Even MacOS has perl.
msl09
Great stuff. I hate having to write bash scripts and this seems like a great way to create scripts that will run on even old linuxes. Seems that there are a few sections missing in the documentation, stuff like the standard library and the extended documentation about handling failure, very alpha indeed :^D. I'll definitely be keep an eye on this one.
dpc_01234
If I need an extra tool that will compile stuff, I might as well use a normal compiled or scripting language. Which I often do.
fb03
I think this is a cool concept, and all, but honestly, at this point, why just not use Python3 as your project's scripting language, and reap all the benefits of a simple, typesafe/autocomplete ready language with broad IDE support, and no intermediate 'compile step' which generates "don't touch" code?
liampulles
What I really want for scripting usecases is a language that has modern language concepts (easy to use arrays and maps, text formatting strings, etc) but that allows me to call commands as easily as I could call functions.

Maybe there are existing scripting langs that make this so? Ambers approach is not bad but I feel it could be even better.

nathan_compton
This really can only work if the error messages map back to the right line number, right? I used to f with transpilation and if you can't get the error line at least, its a really huge overhead for not much gain, given that transpilation can only move the semantic needle so far.
queuebert
Having some array syntactical sugar alone would be invaluable for us casual Bash programmers.
Jaxan
I know it’s not done to comment only on the websites appearance, but on a small screen the website is a mess: https://pasteboard.co/JoVqLPM106ks.png
therealmarv
I would use it if we can do a (best-effort) import of existing bash scripts into Amber.
VagabundoP
This fits my use case where I want to run some system commands but Python is too heavy.
v3ss0n
Why would someone need to compile to bash.. how about just use python instead
yau8edq12i
I guess I don't understand the point. Could someone summarize why I would use this rather than writing my utilities in something that doesn't compile to a quirky, limited programming language?
Alifatisk
The homepage is good looking and I applaude them for that, but I gotta admit, it's almost too dark for me to see some of its content. I think grey text on black background is risky move.
iansinnott
Odd that (on desktop) the actual install URL is obscured by a gradient.
1propionyl
Looking at the output I find myself thinking: "if this kind of thing caught on, it would only be a matter of time until someone proposes a BASM (Bash ASM)..."
Humphrey
Love the idea, but I've found myself switching to Python once my bash scripts get to complex. Easy to maintain, and doesn't need compiling.
krunck
The Amber installer is itself created from Amber. I suppose that makes sense....

I would prefer that it produces code with a bit more whitespace for readability.

hi-v-rocknroll
Adjacent: I've yet to find a good bash transpiler (to C at least), but I think it would help make some slower scripts usable.
throwaway894345
Man, I'll bet that's a real joy to debug.
maupin
I like how the website is as easy to read as a glossy magazine brochure in a gloomy cave entrance on an overcast day.
evnix
I 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.

pgt
Would be great if a compiler existed that compiles ClojureScript or Babashka code to Bash.
cvrajeesh
Is this a transpiler or compiler?
snickerer
I totally understand the drive to a more modern shell language. But why translate Amber into bash, why not execute it directly? Why there isn't an Ambersh?

We 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?

classified
Is this some kind of hoax? The page just shows an image. This looks very suspect.
ceving
I like the Kafkaesque design: https://i.imgur.com/U1mpq7e.png
replwoacause
Very interesting. Don’t think I’ve seen anything like this before. How would the speed on something like this be compared to PowerShell, for example? Is it faster because it’s compiled? Could I write a web server in it?
adityamwagh
The design of the website is so damn cool.
v3ss0n
Why would someone need to compile to bash..
forinti
I dunno, why not just use Perl or Python?
up2isomorphism
Compile to Bash? Why not compile to English then?
ARandomerDude
Why would a person go this route instead of a higher-level scripting language (Python, JS, Ruby, etc.) or a full-blown binary (Go, Rust, etc.)?

I don't get it. Asking not to be rude but to be educated.

srid
Now someone needs to add this to Nix, by providing an alternative to `writeShellApplication`:

https://nixos.asia/en/writeShellApplication

Woshiwuja
thats one ugly site
reisub_black
Why does the documentation need WebGL?

I have WebGL disabled in my main browser for privacy reasons (super-easy to fingerprint), and I only get to see 'Application error: a client-side exception has occurred (see the browser console for more information).' with an error about ThreeJS initialization in the console.

I assume it's for the fancy animation, and I find that ridiculous. Loading a whole 3D library just to show a fancy animation. This could have been done much simpler by using an animated image format, though admittedly with less functionality - but is it even needed?

I fear the whole industry suffers from overengineering and this is just a symptom.

Even if you're convinced you need the fancy animation, why not gracefully fallback to not showing it and still make the docs usable?

orthecreedence
Quick note to the creators: the website looks almost exactly like every other "here try this cool command-line utility so we can hook you and start charging a service fee for it" startup website and I instantly distrusted it. The design communicates that you're selling a product, not providing an open-source utility.

That said, very interesting syntax. I agree with others about the $...$ being kind of odd, but other than that this is really cool.

galdosdi
Cool idea. In practice: they already did this and it's called PERL!

Why would I ever use this instead of just using perl5, which solves all these problems already and is preinstalled on every Unix machine I've ever seen (and I've seen a lot from HPUX to AIX) since there's always some ancient innards component that depends on it, so it's basically impossible to remove...

And even if you don't know perl, you're better off learning it than Amber, because perl may not be super popular anymore but it's still way way bigger with way more resources and libraries and documentation and even people you could hire etc etc (If you prefer python2, you can probably get close to but not quite the same level of universal compatibility)

jamesponddotco
Slightly 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 "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.

hasante
Good stuff - always wanted to write bash but not really write bash or learn it deeply. It's amazing world seeing these tools come out.

Just built a CLI a couple days ago with golang and it was an incredible experience where these things have come.

Things - acute product dev tools. Tools to create peculiar or not soo common tools.

hasante
[dead]
auxfil
[dead]
thezipcreator
the website doesn't seem to render right on Firefox for some reason (works with Chromium tho)
casey2
It seems to generate very bad/odd shell so I won't use it.

I also question the mindset that conflates programming with using a program. It seems until some philosopher explains the difference programming can't move forward.

Aside from that shell is the way many (most?) people interact with their computer, so some may find it offensive.