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.
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.
16 Comments
I_Am_Jacks_____@sh.itjust.works · 21 pts · 31d
You Suck at Programming on Youtube
tvcvt@lemmy.ml · 10 pts · 31d
For learners who are helped by seeing someone think through a problem and explain why they made the choices they did it doesn’t get much better than YSAP. (Here’s the link: ysap.sh)
GaumBeist@lemmy.ml · 2 pts · 30d
Here's the direct link
MonkderVierte@lemmy.zip · 13 pts · 30d
shellcheck.net
Also, advanced bash is mostly about structuring code for maintainability, exception handling and some good tidbit functions you can easily adapt. Actually a good experience for creating maintianable lower-level code too.
Edit: right, most important: always set a default value, if you have a variable in a path.
That said, i have a (POSIX) cheatsheet i still regularly use. Most important parts:
Btw, if it goes over 100 to 150 loc, go Python at least. No matter how disciplined you are or how clean your code is, it gets messy.
SocialistVibes01@lemmy.ml · 0 pts · 28d
Pyhton, Perl, or Awk? Is there any sense at choosing nowadays?
RyanUrq1328@programming.dev · 11 pts · 31d
https://www.youtube.com/channel/UCMN0a7GHQnC6H74SmCGSmdw
YSAP, does a lot of basics, but has some videos about more obscure stuff too Well delivered and interesting
CallMeAl@piefed.zip · 9 pts · 31d
The Advanced Bash-Scripting Guide and Classic Shell Scripting[PDF] are both great IMO.
moonpiedumplings@programming.dev · 7 pts · 31d
Overhewire bandit is a tutorial and introduction to CTF's. It covers some of the lesser known commands like strings or uniq, by making you use them in challenges. Of course, it later goes on into basic exploits. But it's a good intro to some of that stuff, and I like that it's hands on.
GaumBeist@lemmy.ml · 5 pts · 30d
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)
vi21@lemmy.ml · 4 pts · 30d
The hard part for me was dynamic scope, which I found it was explained nicely in The Common Lisp Condition System: Beyond Exception Handling with Control Flow Mechanisms. Since then I have begun to feel that dynamic scope in Bash is a feature, not limitation.
JTskulk@lemmy.world · 4 pts · 31d
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.
ranzispa@mander.xyz · 3 pts · 30d
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 | wcat this point bash just becomes a way to put pieces together and you do not need very advanced features.vas@lemmy.ml · 2 pts · 31d
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...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.Franconian_Nomad@feddit.org · -4 pts · 31d
Shh, LLMs are quite good at stuff like this. Let them teach you. Use a command line harness like opencode or whatever tickles your fancy.
Use a local model like Qwen 3.6 if you can, and start having fun. You might to have to learn how to use a LLM effectively though, to mitigate their disadvantages like hallucinating and their non-deterministic nature. Also, they want to do everything with curl, maybe find some alternatives to that.
Eggymatrix@sh.itjust.works · -10 pts · 31d
Seconded. I have worked on linux for 15 years doing software dev and some IT. Nobody knows that stuff in detail unless they have to because of some arkane deployment reason. Any half good local llm will be miles ahead of most books. Tell it what you need, it will spit out some code, understand the code and ask it or search online how it works exactly. Rinse and repeat.
a_fancy_kiwi@lemmy.world · -6 pts · 31d
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.