[For reference, I’m talking about Ash in Alpine Linux here, which is part of BusyBox.]

I thought I knew the big differences, but it turns out I’ve had false assumptions for years. Ash does support [[ double square brackets ]] and (as best I can tell) all of Bash’s logical trickery inside them. It also supports ${VARIABLE_SUBSTRINGS:5:12}` which was another surprise.

At this stage, the only things I’ve found that Bash can do that Ash can’t are:

  • Arrays, which Bash doesn’t seem to do well anyway
  • Brace expansion, which is awesome but I can live without it.

What else is there? Did Ash used to be more limited? The double square bracket thing really surprised me.

  • Daniel Quinn@lemmy.caOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    11 months ago

    Yup, that looks like exactly what was done in Alpine:

    $ docker run --rm -it alpine ls -l /usr/bin/[[
    lrwxrwxrwx    1 root     root            12 Sep 28 11:18 /usr/bin/[[ -> /bin/busybox
    

    So while the Ash itself doesn’t support the [[ extension, this work-around produces the same effect. Nifty.