FLOSS Weekly Episode 790: Better Bash Scripting With Amber

This week Jonathan Bennett and Dan Lynch chat with Paweł Karaś about Amber, a modern scripting language that compiles into a Bash script. Want to write scripts with built-in error handling, or prefer strongly typed languages? Amber may be for you!


Did you know you can watch the live recording of the show Right on our YouTube Channel? Have someone you’d like use to interview? Let us know, or contact the guest and have them contact us! Take a look at the schedule here.

Direct Download in DRM-free MP3.

If you’d rather read along, here’s the transcript for this week’s episode.

8 thoughts on “FLOSS Weekly Episode 790: Better Bash Scripting With Amber

  1. Way wrong on Busybox.

    The biggie is that there are _two_ shell implementations in Busybox, neither of which are Bash. One is called “hush” and is rarely used. The default one used almost everywhere is ash, the predecessor to Debian’s dash, and currently used as the default `/bin/sh` on some (not all) BSD systems. This is the type of thing the Amber author meant when they said they did not yet support “sh”. The proper term for this is POSIX shell compatibility, and it means rolling back all features added to Bourne-family shells since 1988.

    Secondarily, Jonathan said something about not having sed and grep and all in this Busybox environment, but of course [that is not true](https://busybox.net/downloads/BusyBox.html). Indeed, shipping a pared-back copy of Busybox would be one way to get Amber’s dependencies on systems that lack it. It would solve Amber’s needs without them needing to take on the portability burden.

    (By the way, I support their use of external binaries to extend Bash’s capabilities. It’s how Bourne shells are meant to be extended; the “standard library” of a shell script is the contents of `PATH`. It is because of all this that Bash is so weak as a scripting language, inviting the creation of everything from awk to Perl to Amber.)

    An easy way to work out how badly incompatible Amber is with POSIX shell is to fire up an Alpine Linux container:

    $ podman run -it –rm alpine

    There’s little more there besides Busybox: Musl’s libc, a tiny package manager, and that’s about it.

    I find it suggestive that there is no “amber” package in APK.

    1. I think you missed the point. The full sed and grep usually aren’t available in an embedded environment. Busybox can be called with those names, if those functions have been compiled in, but it only supports a subset of the features of the full program. Whether that’s sufficient depends on what Amber uses those binaries for.

      I had no clue about hush, though. Neat tidbit.

      1. The topic was portability to non-GNU systems; I don’t think anyone is expecting to find GNU sed or GNU grep on an embedded system. A better comparison is between Busybox and POSIX.

        Busybox sed exceeds POSIX in supporting -r and -i. Compare:


        Busybox’s brief manpage snippet doesn’t tell us about the SED_CMD language it supports, but since POSIX goes back to 1988, it might well be fully POSIX-compliant. A modern embedded system will run rings around the Sun-3 and Sun-4 class boxes prevalent at the time.

        There’s a similar story for grep:


        Busybox’s grep implementation doesn’t support POSIX’s oddball -x option, but it does support things like -r from BSD and GNU grep that POSIX never specified.

        All of this is relevant to the Amber discussion in that the wish for POSIX shell compatibility means there is no reason they should depend on anything else not specified by POSIX, at least when running in that non-BSD non-GNU mode.

  2. Jonathan and friends: Still love the show after the move from Twit and all those years. After moving the recording to Tuesday, you are aware that the RSS feed is only updated late CET on Wednesdays?

    Cheers, the Linux Inlaws (your fiercest competition 😅)

    Looking for an almost better FLOSS podcast? Check out Linux Inlaws! (comment approved by the Committee of Affirmative Action Podcasting and the Coalition of American Civil Liberty Audio Broadcasting Union)

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.