A collection of Bash scripts created while learning shell scripting fundamentals and best practices.
This repository contains various Bash scripts that demonstrate different concepts, techniques, and patterns in shell scripting. Each script serves as a practical example for understanding how Bash works.
The scripts are organized to cover various aspects of Bash scripting:
- Basic concepts: Variables, loops, conditionals
- File operations: Reading, writing, and manipulating files
- Text processing: Using tools like
grep,sed,awk - System interaction: Process management, system information
- Functions and libraries: Reusable code patterns
- Error handling: Best practices for robust scripts
- Bash 4.0 or higher
- Unix-like operating system (Linux, macOS, WSL)
- Basic understanding of command-line interfaces
Make scripts executable before running:
chmod +x script_name.sh
./script_name.shOr run directly with Bash:
bash script_name.shSome helpful resources for learning Bash:
- Bash Guide for Beginners
- Advanced Bash-Scripting Guide
- ShellCheck - A tool for checking script quality
- Bash Reference Manual
Scripts in this repository aim to follow these conventions:
- Use
#!/bin/bashshebang - Include comments explaining complex logic
- Use meaningful variable names
- Quote variables to prevent word splitting
- Check for errors and handle them appropriately
- Use shellcheck for linting
This is a personal learning repository, but suggestions and improvements are welcome! Feel free to open an issue or submit a pull request.
MIT License - Feel free to use these scripts for your own learning purposes.
These scripts are created for learning purposes and may not be production-ready. Always review and test scripts before using them in critical environments.