There is lots of books, videos and manuals about bash. So it is hard to tell if one is good or not. By advanced bash I mean regular expressions, complex scripts, and kind-of obscure options of basic commands no beginner tutorial tells about.

  • vas@lemmy.ml
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    4 months ago

    My personal basic tools for learning:

    • man bash. That’s the documentation for everything. It’s very careful and serious though, so sometimes you need…
    • Search in internet if you think your particular question is very “repeatable”. Stackoverflow used to be good, but now they’re all “AI AI AI by the way have you heard about AI?”. So I’m not recommending it anymore. For “advanced bash” there are pages that go over those “advanced topics”, too!
    • Run shellcheck to read your code and give suggestions/warnings. It’s a great tool for learning, too, besides the primary goal of reviewing code to be production-ready.
    • Sometimes, with extreme care, ask an LLM to review your code or give siggestions. It tends to hallucinate a lot, makes up wrong and unexisting stuff, but sometimes it’s useful, too. Especially at finding bugs. Again, it can be useful, but use with care. Oh, and it can actually be great at explaining, too. Throw it some syntax/code and it’ll explain wtf is going on. This part is very reliable and good.

    At my current level of experience I need mostly man bash, and occasionally all of the rest. Before I used a lot of stackoverflow and simply thinking of what I even want.

    • ScoffingLizard@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      1
      ·
      17 days ago

      I have a tough time reading man pages. It seems to be harder since everything went to systemd. After 20 years of Linux use, I still feel really dumb. I’m just now getting better with Vim keying.

      Is there a trick to reading man page formats? I’m a bit autistic and not an intuitive communicator. Sometimes I wish man pages had more example commands. I also wish there was a way to freeze the format at the top while scrolling options so I didn’t need to have 3 windows open to see format, scroll options, and have another open for actually typing.

      • vas@lemmy.ml
        link
        fedilink
        arrow-up
        2
        ·
        17 days ago

        Unfortunately I don’t think I know the answers to your questions. I do what you say: open one or multiple tabs in my terminal emulator if I need to read multiple parts at the same time. I press / and then type in some case-sensitive text if I want to search for occurrences of this text. Or I press ? and some text to search backwards. And the rest I “lamely” do with pressing up-down arrows…

        Learning by example is exactly the second layer I’m referring to in my text above. Man pages are very… formal. If I don’t yet understand what they even talk about, I need examples before their concepts become “native” to me.

        I can’t “teach” well really - but I’m explaining how this works for me. I used to hate man pages, now I love them. Even a very difficult one like man bash. There is a point in the learning curve where it gets a lot better…

        • ScoffingLizard@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          1
          ·
          15 days ago

          That’s still useful information. I use the Linux Command Library from FDroid. It is really good for seeing similar commands, variations, one liner examples, cheat sheets for Vim/Emacs, etc.

          I can recommend that for others like me who have trouble with commands.

  • ranzispa@mander.xyz
    link
    fedilink
    arrow-up
    3
    ·
    4 months ago

    To be fair, bash is pretty simple. You can find the syntax for regular expressions, string manipulation and stuff like that by searching the syntax on the internet. It is not too long.

    You can read the manual, it explains all that. That should be enough, I would not say you need much more than that.

    Now, if you’re talking about using bash scripts professionally, I’d say you should focus on studying programming in general, not really focused on bash scripting. But at that point you’ll realize that bash scripts are pretty much a useful quick utility, not something you’d really want to write complex logic with.

    If you want to be proficient in using your system, rather than learning the whole syntax of bash I’d say knowing what the GNU tools are is very much more useful.

    You want to get the number of unique values in a column of CSV? cut | uniq | wc at this point bash just becomes a way to put pieces together and you do not need very advanced features.

  • JTskulk@lemmy.world
    link
    fedilink
    English
    arrow-up
    3
    ·
    4 months ago

    Everyone here is throwing resources about where to learn more about Bash instead of answering the question. I’d say regex is good to learn regardless as it’s pretty much used everywhere, but advanced bash scripting probably isn’t worth the trouble unless you’re using sysvinit scripts or something. Bash was really the first language I learned and nowadays I find myself starting scripts in bash and then quickly converting over to python the moment I have to manipulate strings. Python is much more straightforward in that regard.

  • GaumBeist@lemmy.ml
    link
    fedilink
    arrow-up
    3
    arrow-down
    1
    ·
    4 months ago

    Not to be that gal, but… the GNU site’s Bash Reference Manual documents everything you could ever want to know right up until you get into weird edge cases and abusing bugs/unintended behaviors for your own nefarious purposes.

    For that, others have pointed to YSAP, whom I will also recommend. I can’t find it right now, but I swear in some videos he mentions a website or forum where people discussi Bash extremely in-depth, and that is end-game stuff (the stuff you learn right before you start auditing the code yourself or editing the source to enable your own custom behaviors)

  • a_fancy_kiwi@lemmy.worlddeleted by creator
    link
    fedilink
    arrow-up
    4
    arrow-down
    10
    ·
    edit-2
    4 months ago

    I run Qwen2.5 Coder 14B locally for boiler plate stuff that I then edit myself and it’s been great. I write code irregularly so using an LLM is nice when I know what I want to do, how to logically do it, but I’ve since forgotten the syntax.

    Edit: I figured this would be a little contentious. If you write scripts so often that you feel like it’s worth it to invest time in becoming better at them, then by all means. This is just a hobby for me. As much as I’d love to do so, investing time in getting better at scripting is unfortunately a waste.