A structured, hands-on Bash scripting repository containing lessons, practice labs, assignments, solutions, quizzes, posters, and progressively more advanced automation projects.
This project begins with true beginner concepts and introduces advanced topics only after the required foundations have been practiced.
Learn → Type → Run → Make Mistakes → Debug → Verify → Automate
Each learning day may include:
- Lesson notes
- Beginner-friendly command practice
- Hands-on assignment
- Separate instructor solution
- Interactive MCQ quiz
- Visual study poster
- Verification checklist
Topics:
- What a shell is
- Bash introduction
- Terminal versus shell
- Simple Linux architecture
- User → Shell → Kernel → Hardware
- Machine-information commands
- Basic file and directory commands
- Vim and Nano introduction
- Shebang and comments
- First Bash script
- Execute permission
bash hello.shversus./hello.sh
Topics:
- Standard output and standard error
- Successful and failed commands
- Exit status using
$? &&and||- Multiline descriptions
- Simple Bash variables
- Variable expansion
- User input with
read - Creating a Linux user with
useradd - Checking users with
idandgetent passwd - Verifying the real command result before reporting success
shell-scripting/
├── README.md
├── Day-01-Shell-Basics/
│ ├── Assignment/
│ ├── Solution/
│ ├── MCQ-Quiz/
│ └── Posters/
├── Day-02-Output-Variables-User-Creation/
│ ├── Assignment/
│ ├── Solution/
│ ├── MCQ-Quiz/
│ └── Posters/
└── Future-Days/
Empty directories are not stored by Git. Add a README.md or .gitkeep file when an empty directory must be preserved.
The scripts for each day use only concepts already taught by that point.
For example, the first beginner scripts do not use:
- Functions
- Arrays
- Loops
- Advanced argument parsing
- Strict mode
- Regular expressions
- Complex error-handling frameworks
These concepts will be introduced gradually in later lessons.
You can practice using:
- Ubuntu Linux
- WSL Ubuntu on Windows
- A Linux virtual machine
- An approved AWS EC2 lab instance
Check the environment:
echo "$SHELL"
echo "$0"
bash --version
whoami
hostname
pwdRun a readable script through Bash:
bash hello.shGive the script execute permission and run it directly:
chmod u+x hello.sh
./hello.shCheck its syntax:
bash -n hello.shNo output from bash -n normally means no syntax error was found.
Students should complete the assignment before opening the corresponding solution.
Recommended workflow:
- Read the assignment.
- Type every command manually.
- Create the required scripts.
- Test successful and failed cases.
- Record errors and corrections.
- Run the verification commands.
- Compare the work with the solution.
- Complete the MCQ quiz.
- Use WSL, a disposable VM, or another approved Linux lab.
- Do not test user-management or deletion scripts on production systems.
- Do not manually edit
/etc/passwd,/etc/shadow, or/etc/group. - Never store plaintext passwords, tokens, private keys, or cloud credentials in Git.
- Check a command's result before printing a success message.
- Read scripts carefully before using
sudo.
| Stage | Topics |
|---|---|
| Foundation | Shell, Bash, commands, editors, scripts, permissions |
| Variables and input | Variables, quoting, input, substitution, arguments |
| Decisions | Exit status, tests, if, elif, else, case |
| Repetition | for, while, until, break, continue |
| Reusable scripts | Functions, parameters, local variables, return status |
| Structured data | Indexed and associative arrays |
| Linux automation | Files, logs, processes, services, backups, monitoring |
| Production practices | Validation, logging, traps, debugging, ShellCheck, testing |
| Capstone | Linux Operations Automation Toolkit |
git status
git add .
git commit -m "Add Bash scripting learning materials"
git pushUse small and meaningful commits for each learning day.
https://github.com/kcommit/shell-scripting
Muhammad Khalid Khan
GitHub: kcommit
The purpose of this repository is to build practical Bash scripting skills through consistent terminal practice, carefully sequenced assignments, and real Linux administration examples.
Start simple. Understand every line. Then automate with confidence.