How to Learn to Write Bash Scripts: Recommended Materials
Greetings!

In this note, I have put together a small roadmap for those who want to learn programming in the Bash shell language.

This map is based on my experience learning to write Bash scripts. Do not be afraid of its size: if you study at least a quarter of the material listed here, you will already be able to solve many tasks related to Linux automation by writing Bash scripts.

Step 0. About Working in the Command Line

An important step! If you do not feel confident when working in the Linux command line, do not rush to write scripts. First, it is worth learning to understand and use the main shell commands and mechanisms in practice☝️.

My blog has a separate series of articles on the Linux command line, intended for beginners (and not only). After studying this series, you will be able to confidently perform most typical tasks encountered in the Linux terminal👨‍💻.

Below are links to articles from this series:

Step 1. A Series of Articles on Habr (Part One)

Today many advanced Linux users begin their journey in automating destruction of the system precisely with the Habr articles listed below👇.

I intentionally split them into two parts, because the articles from the second part imply more advanced use of specific utilities🤷‍♂️.

The very beginning of script writing:

Step 2. The Book “The Linux Command Line”

This step can serve as an alternative to the previous one - only in book format and sometimes more in-depth, while still understandable👽.

Book: “The Linux Command Line”, author - William Shotts. More specifically, its 4th part: Shell Scripting.

I would recommend reading the whole book - in places, it will surprise even a very experienced user. But if the goal is to learn how to write shell scripts correctly, then…

You can buy the book or easily find it somewhere else. Well, you get the idea 😉.

Step 3. A Series of Articles on Habr (Part Two)

If you have reached this stage, it means you already know something and are ready to make your brain boil🔥.

The articles from this step are not mandatory to study, but are highly recommended☝️. sed, awk, and regexes will often appear before your eyes if you actively study Linux systems🐧.

There is also an article here with selections of practical examples and a demonstration of the expect command’s capabilities:

Step 4. Required Reading

After everything covered, it is very important to learn the subtleties of Bash programming. The shell is a specific tool, and there are many nuances in how it works. Therefore, in my opinion, the two articles below are required reading📑.

The first demonstrates a minimal safe Bash script template, and the second talks about the specifics of scripts written in this shell language.

Step 5. My Materials

If after all this you still have an interest in Bash scripting, you can study thematic materials from my blog:

Or study scripts used in some articles:

Bash scripts are the foundation of Linux automation. This skill is required in many DevOps/admin vacancies in the IT market👨‍💻. Yes, there are many other tools that can solve the same tasks, for example Python, Lua, Perl, PHP, JavaScript, Go, C, Rust, and so on. But the truth is always somewhere in the middle. As they say, each task has its own tools😌.

Study Bash. I wish you good luck in script writing!

Copyright Notice

Author: Иван Чёрный

Link: https://r4ven.me/en/automation/kak-nauchitsya-pisat-bash-skripty-rekomenduemye-materialy/

License: CC BY-NC-SA 4.0

Использование материалов блога разрешается при условии: указания авторства/источника, некоммерческого использования и сохранения лицензии.

Start searching

Enter keywords to search articles

↑↓
ESC
⌘K Shortcut