I'm BREAKING UP With Bash (Using dash as /bin/sh)

Поделиться
HTML-код
  • Опубликовано: 24 авг 2024

Комментарии • 21

  • @softwarecitadel
    @softwarecitadel Год назад +28

    I highly dislike both bash and dash, I prefer cash. Aside from the joke, thanks for this video ;) Cheers from France !

  • @MisterConscio
    @MisterConscio Год назад +3

    9:22 On the shellcheck command output, if you follow that link, it will open a page where it give code examples on how to replace arrays.

    • @EricMurphyxyz
      @EricMurphyxyz  Год назад +1

      That's why I prefer using shellcheck as opposed to checkbashisms, the wiki it links to is very useful

  • @saumitit944
    @saumitit944 Год назад +2

    I tried to do this thing few months back. However, I switched back to having bash as my default shell for the following reasons:
    1) I run linux natively on pretty modern hardware, so there really is not much overhead provided by bash compared to dash. It may be few milliseconds faster, but for me, it's not even noticeable.
    2) First point, doesn't really justify not switching because it's neither a positive nor a negative for me to change, However, I use some scripts using dmenu, which use non-posix compliant bashism or some "bloat" in form of extra flags in gnuutils which aren't recognized by dash.
    Took me a while to figure out some of it, learned about POSIX shell and that bashisms aren't just limited to shell but also gnuutils. Like how BSD echo is different from GNU echo and so on.
    ...
    For example, echo -e "up\down\connect" | dmenu
    in bash gives (using "|" as separations of the different options)
    up | down | connect ✅✅
    in dash gives
    -e up | down | connect ❌❌
    ...
    So simple thing right? just replace the -e flag with something standard... like just use

    echo "up
    \down
    connect" | dmenu
    if you run a script having this in dash it'd produce
    up | down | connect ✅✅
    HOWEVER, now Bash breaks it?? giving
    up
    down
    connect ❌❌ as one single option
    ...
    At last, I ended up switching from simple echo to printf just to pipe the output to dmenu.
    I saw luke smith's video on GNU is bloated and then Brodie's video on POSIX and just got to terms with using bash as my system shell.
    If I were handling an enterprise-grade server running linux, where security is paramount, I would switch the system shell to dash(if it already isn't) else for my personal computer where threat model is alright I would just stick to using bash.
    ...
    If you wish to check whether your script would run in dash without having to reboot your computer over and over again and checking if it breaks or not (totally not me lol) just use shellcheck --shell=dash

  • @danny.cuevas
    @danny.cuevas Год назад +2

    Beautiful videos man, pretty well edited, and content is pretty good as well!, I am subscribed!. Quick question, do you have any videos-tutorials on how did you tune-up your terminal and OS to look that way? everything looks so comfy and elegant!
    Cheers from Mexico City (:

    • @EricMurphyxyz
      @EricMurphyxyz  Год назад +2

      I do have some old videos on my terminal setup, here's one for my terminal prompt: ruclips.net/video/OXKhv2rXLBo/видео.html
      I will make some videos on setting up bspwm and how I make my OS look like this in the future, so stay tuned!

    • @danny.cuevas
      @danny.cuevas Год назад

      @@EricMurphyxyz sounds great, I will be waiting! XD and thank you

  • @thedeathchimera
    @thedeathchimera Год назад

    For a non-posix shell I'd reccomend Elvish. Had a lot of fun writing scripts with it (not a system shell though).

  • @laughingvampire7555
    @laughingvampire7555 11 месяцев назад

    my issue about this is that bash is the default shell in most of the distros so if you are going to install another scripting runtime then you should better write your scripts in a decent scripting language that doesn't have the context-switching mess of shell scripting and use perl, python, lua, ruby, guile, etc.

  • @joaopauloalbq
    @joaopauloalbq Год назад +1

    How bad is writing POSIX-Compliant shell scripts?

    • @EricMurphyxyz
      @EricMurphyxyz  Год назад +3

      From my experience? It's not really that bad if you write it from the start as POSIX shell compliant, but if you try to rewrite a large bash script it can be a nightmare. Some scripts are just easier to do with bash, but there's usually a workaround

  • @laughingvampire7555
    @laughingvampire7555 11 месяцев назад +1

    ubuntu is pronounced oo-boon-too, not you-bun-too

  • @f_aaris
    @f_aaris Год назад

    Great video but sadly dash was causing quite a few issues for me so won't be using it for now. Maybe in the future it'll be a viable alternative or maybe even the recommended program for a /bin/sh

    • @EricMurphyxyz
      @EricMurphyxyz  Год назад

      What kind of issues? I'm curious

    • @f_aaris
      @f_aaris Год назад

      @@EricMurphyxyz I was able to fix some but I'm also using zgenom and I seem to get a lot of bashisms with the plugins and the autoupdater and stuff. I could manually change them to bash but since they're coming from a git repo I'd rather not

  • @ade5324
    @ade5324 Год назад

    alternative title: Bash is Trash

  • @nico1337
    @nico1337 Год назад

    I use the AUR package dashbinsh. pfetch hostname works fine for me. (pfetch-git from AUR). And my scripts use "#!/usr/bin/env bash"

    • @EricMurphyxyz
      @EricMurphyxyz  Год назад +1

      Guess I don't have the latest version of pfetch. I should have mentioned that #!/usr/bin/env bash is more portable, that's what I use when I write bash scripts