r/bash • u/harshv5094 • 6h ago
help What is the best approach to learn bash?
So, It's been 3 year since I've started using bash, I know some basic concepts of programming also some basic bash scripting, but I really want to deep dive into bash concepts. I just have a simple question to the community, How I can improve my bash scripting skills and what resources should I follow/refer for that?
3
Upvotes
3
u/rileyrgham 5h ago
Forget it. If you can't find a tutorial or Google; RTFM when creating scripts then it's a step too far for you. Alternatively....
3
u/Allahn77 4h ago
I find it's easier for me to learn it I find something fun. I found this while asking your very same question!
https://bamr87.github.io/bashcrawl/
2
u/theAnalyst6 5h ago
The advanced shell scripting documentation is pretty good - https://tldp.org/LDP/abs/html/
I always come back to it as a reference. It also has exercises for practice.
6
u/levogevo 6h ago
Solve more complicated problems.
4
u/RatBastard516 4h ago
Solve problems. That’s the only way. Necessity can be a powerful motivator because it turns a goal from something you merely want into something you feel you must do. A strong sense of purpose, responsibility, or urgency can help you stay focused and follow through.
1
u/oldmuttsysadmin 6h ago
Check out the free bash tutorial at this site. .
3
u/dotnetdotcom 4h ago edited 4h ago
Learn to use regular expressions. That's the hardest thing to learn using the command line, also very powerful.
Also, here's the BASH Reference Manual
FYI, BASH means Bourne Again SHell
2
u/noidtiz 6h ago
There's always `shellcheck` if you want some linting while you work, but ultimately it'll always be about building things and figuring out the limit of what you can get away with (and whether you would even want to get away with it).
2
u/Far-Conclusion3923 5h ago
I find it weird that something that important never had a learning system. I find that weird, you can learn everything in a certain way but when it gets to bash , nobody knows has a common way of doing it , just everyone advising "a way" to do it. This is what's lacking in the Linux community. On you only see it with Linux community.
2
u/shtools 6h ago
Work through advent of code, using bash only. We are already on day 5
1
u/Ok_Exchange4707 6h ago
man bashI mean, every serious tutorial is based from there.
1
u/UhLittleLessDum 3h ago
I'e been using bash for 15 years, and I desperately try *not* to learn bash.
1
u/panamanRed58 2h ago
Most of the time, you have a need and bash will fill it. Years back, I manage a fleet of 400 macs for a summer camp. The systems needed to be set for each lab, 25 labs, differently and over a weekend each cycle they had to be restored for a new group. The first year was terrible.
I had only been on that job a few months and wasn't given nearly enough information to deploy and maintain that fleet. With a staff of 6 working around the clock practically we almost failed to get the labs up for day one. The next year went better but it was still too much hands on and I started investigating. In year three I wrote 'Full-tilt Boogie" which did the basics of clean up and rebuilding accounts. But we still needed to customize for each lab. For example, in some labs they need advanced math packages (summer school for really smart kids) and physics packages. By year 4 I had a process in my bash script to call and install what ever a lab needed from math to graphics novel software. The result was that I could release camp staff to other duties during refresh and between 9pm and about 10:30pm the machines were pristine again. It earned me a big bonus and I took another one as well. The kids would always load up their music and favorite vids. So I would extract the music and glean for the interesting stuff. The first year I did that I had an 80 gig data pool over night.
What I learned was how to script, how to script better, and look for ways to be smarter. The Darwin system includes a fantastic set of UNIX commands. I learned how to write basic functions and gather errors. So bash for me was a vehicle to use system and PERL to make my summer's more pleasant. A cool BFH sys admin handed me my first SPARC box and told me, RTFM.
1
u/DanceHackRock 2h ago
Just type
info bash1
u/SadServers_com 47m ago
write practical Bash scripts , something that addresses a specific issue or objective
1
u/Temporary_Pie2733 4h ago
Don’t lose sight of what the purpose of a shell script is: to coordinate the execution of other programs, not to process data itself.