Amber – the programming language compiled to Bash

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  • ShellCheck

    ShellCheck, a static analysis tool for shell scripts

  • As carlinigraphy points out, shellcheck [0] exists, and can easily be put into pre-commits, a CI pipeline, etc. This would have almost certainly flagged your problem immediately.

    > I would be willing to learn a sane language, but bash isn't one.

    It's a general language that has to be both an interactive interpreter and script executor, and it needs to support a huge variety of architectures and kernel versions, as well as historical decisions. It's going to have some cruft.

    [0]: https://www.shellcheck.net/

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • Batsh

    A language that compiles to Bash and Windows Batch

  • This looks similar to a tool I discovered a while back called Batsh. But Amber looks a lot more polished.

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

  • Amber

    💎 Amber the programming language compiled to bash

  • 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 also get minification and/or obfuscation in exchange for losing readability, and Amber doesn't seem to offer those yet.

  • marcel

    A modern shell (by geophile)

  • shfmt

    Dockernized shfmt. This formats shell script. (by tmknom)

  • Nothing can be done about variable names, but format inconsistencies can be autofixed with shfmt. I've been using it for years and it's been solid.

    https://github.com/mvdan/sh

  • AmIUnique

    Learn how identifiable you are on the Internet

  • If you disable WebGL you're putting yourself in the 2% of devices that don't support it.

    That's not fantastic, but if you enable it, just your WebGL extension list can be used to narrow you down way further than that - according to https://amiunique.org/ just my extensions narrow me down to 0.35%. In my

  • racket-rash

    The Reckless Racket Shell

  • Rash (https://rash-lang.org/) and Oil (https://www.oilshell.org/release/latest/doc/ysh-tour.html) come to mind. Xonsh, too, as mentioned. Powershell too.

    Most high-level languages have packages that implement DSLs for running and connecting subprocesses. Python has both `subprocess` in stdlib and things like plumbum (https://plumbum.readthedocs.io/en/latest/index.html) or fabric as 3rd party packages. Scala has a little DSL ("echo 1" #| "cat" !) for this in stdlib. How lightweight the syntax is depends on how DSL-friendly the language is, so things like Ruby or Raku might be your best bets.

  • SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  • bats-core

    Bash Automated Testing System

  • > 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 effective. We can make an argument for what we believe the perfect shell scripting language would be--but that doesn't exist. Bash is the current tool for addressing this category of problems.

    The intention of this bullet point was to illustrate that just as I wouldn't work in an industry/role requiring C tools, and instead turn to some weird, novel, riddled-with-problems transpiler... I'd just learn C.

    (P.S., bats[0] and shellcheck[1] address many problems noted in this thread.)

      [0] https://github.com/bats-core/bats-core

  • gorun

    gorun is a tool enabling one to put a "bang line" in the source code of a Go program to run it, or to run such a source code file explicitly. It was created in an attempt to make experimenting with Go more appealing to people used to Python and similar languages which operate most visibly with source code.

  • You can use a tool like gorun (https://wiki.ubuntu.com/gorun) to run Go source code as if it were a shell script, by putting gorun in the shebang line.

    Of course the disadvantage is that you need to Go toolchain everywhere you want to use the Go script so it's definitely not as portable as using a regular shell script.

  • amber

    A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance. (by amberframework)

  • https://github.com/amberframework/amber

  • baml

  • 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.

  • monofile

  • Neat! We did something in the similar spirit after having too many beers once : https://github.com/LinusU/monofile

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Shellcheck finds bugs in your shell scripts

    11 projects | news.ycombinator.com | 23 Nov 2023
  • Bash e limbajul DIAVOLULUI

    5 projects | /r/programare | 16 Jun 2023
  • Nsh: A fish/bash-like Posix shell in Rust

    9 projects | news.ycombinator.com | 23 Oct 2021
  • Ask HN: A Bash guide for Posix programmers?

    1 project | news.ycombinator.com | 17 Dec 2023
  • Download Toddler for FREE: Toddler is a bash script that extracts all the TODO comments across your codebase into a markdown file.

    1 project | /r/ToddlerAI | 11 Dec 2023