home.social

#bashism — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #bashism, aggregated by home.social.

fetched live
  1. @dmbaturin @jessebot
    I once received a shell script to add to our stack from a third party developer for the purpose of an integration project. I pointed out a #bashism (we were running busybox sh with partial bash compatibility). I then received an updated patch that only changed the shebang from #!/bin/sh to #!/bin/bash . So I had to explain again.

  2. @davetron5000 BTW, the code I posted before had errors. Here's a one-liner that actually works with #Docker and #AlpineLinux.

    ```bash
    docker run --privileged -i --rm alpine:latest \
    <<< 'apk update && apk add usbutils && lsusb -t && exit'
    ```

    The redirection operator is a #bashism that won't work as-is in #Bourne or #FishShell. However, I validated that it works as intended under Bash, and thus probably under #Z-Shell. Hope it's useful to you, or to anyone running #TrueNAS Scale.

  3. @davetron5000 BTW, the code I posted before had errors. Here's a one-liner that actually works with #Docker and #AlpineLinux.

    ```bash
    docker run --privileged -i --rm alpine:latest \
    <<< 'apk update && apk add usbutils && lsusb -t && exit'
    ```

    The redirection operator is a #bashism that won't work as-is in #Bourne or #FishShell. However, I validated that it works as intended under Bash, and thus probably under #Z-Shell. Hope it's useful to you, or to anyone running #TrueNAS Scale.

  4. i feel silly i didnt know this #bashism already. take a ; delimited list and loop on it's values

    DATA="this=that;is=isnt;a=b;list=ok"
    D=""
    for opt in ${DATA//;/ }; do
    D="${D} -d ${opt}"
    done
    curl -x POST "$D" api/search

  5. i feel silly i didnt know this #bashism already. take a ; delimited list and loop on it's values

    DATA="this=that;is=isnt;a=b;list=ok"
    D=""
    for opt in ${DATA//;/ }; do
    D="${D} -d ${opt}"
    done
    curl -x POST "$D" api/search

  6. @nixCraft missing POSIX form
    [ "${var%search*}" != "${var}" ]
    No need for #bashism

  7. @nixCraft missing POSIX form
    [ "${var%search*}" != "${var}" ]
    No need for #bashism

  8. #Unix #shell fun fact:

    “source” is a #bashism. The actual #POSIX name of the command is “.”. That’s right, a single dot.

    Many people expect . to be some kind of a shortcut for “source”, and yes, they’re equivalent in #bash, but “source” is not guaranteed to exist in other shells. dash doesn’t have it, for example.

    So, if you want to write your shell scripts as compatible as possible, use “.”, not “source”.

    #Linux #CLI

  9. #Unix #shell fun fact:

    “source” is a #bashism. The actual #POSIX name of the command is “.”. That’s right, a single dot.

    Many people expect . to be some kind of a shortcut for “source”, and yes, they’re equivalent in #bash, but “source” is not guaranteed to exist in other shells. dash doesn’t have it, for example.

    So, if you want to write your shell scripts as compatible as possible, use “.”, not “source”.

    #Linux #CLI

  10. @konst Since you’re saying “etc.”, I feel compelled to mention that `<<<` works in bash, but is not in POSIX and will therefore for example not work in #!/bin/sh scripts in Debian. See mywiki.wooledge.org/Bashism

    #bashism

  11. @konst Since you’re saying “etc.”, I feel compelled to mention that `<<<` works in bash, but is not in POSIX and will therefore for example not work in #!/bin/sh scripts in Debian. See mywiki.wooledge.org/Bashism

    #bashism

  12. @T045T Was mir da noch einfällt: Das ist zwar #bashism und daher verwende ich es nicht, aber du kannst in bash scripts mit pushd und popd arbeiten und damit dir damit einen pfad historie aufbauen und wieder zurück gehen.

  13. @xarvos @Haydar I used FreeBSD for a few months, but went back to Linux. The reasons were, that I had to rewrite all my scripts ( #bashism ) and a lot of stuff just didn't work. Even if it's a good system, the bigger community is on the Linux site and more software is available for Linux. Many git repos I checked out wouldn't work on *BSD, but on Linux.

  14. @Fritange I used FreeBSD for several months and got other problems, I didn't see coming.

    I published a lot of scripts, many are written in bash and that's what doesn't exist directly in the BSD world. I had to rewrite most of them, because the *BSD community told me I have a decease called #bashism and rewriting scripts to make them usable for Linux AND *BSD makes them bloaty.

  15. @climagic hmm, seems to be a #bashism, at least /bin/sh doesn't do it.