Welcome to the Shell Scripting Examples repository! This space is dedicated to helping you learn and master the art of shell scripting, providing a variety of scripts ranging from basic to advanced levels.
Shell scripting is a powerful tool for automating tasks in Unix-like operating systems. The scripts are written in a scripting language interpreted by a shell, which is a command-line interpreter. The most common shell is Bash (Bourne Again SHell), but there are others like Zsh, Sh, and Fish.
This repository contains a collection of shell script examples to demonstrate best practices, common patterns, and useful techniques. The scripts are categorized by their complexity and use case, making it easy for you to find what you need.
The repository is organized into several directories, each containing scripts related to a specific level of complexity or a particular use case:
-
0.basic-examples: Contains scripts that demonstrate basic shell scripting concepts and operations. Perfect for beginners who are just getting started.
hello-world.sh
: A simple script that prints "Hello, World!" to the console. [done]
-
1.intermediate-examples: For those who are familiar with the basics and want to delve deeper.
arithmetic-calculate.sh
: How to perfom basic arithmetic operation.arithmetic-calculate-test.sh
: Testarithmetic-calculate.sh
.file-operations.sh
: How to perform operations on files.networking.sh
: Scripts that involve networking operations.text-processing.sh
: Scripts for manipulating text.
-
2.advanced-examples: Advanced scripts and techniques for experienced users.
automation-test.sh
: Testautomation.sh
.automation.sh
: Examples of automation scripts.script-template-test.sh
: Testscript-template.sh
script-template.sh
: A template for creating well-structured scripts.set-permissions-test.sh
: Testset-permissions.sh
.set-permissions.sh
: Script to assigment permissions to file.system-monitoring-test.sh
: Testsystem-monitoring.sh
.system-monitoring.sh
: Scripts for monitoring system resources.
-
3.utils: Common utilities and functions that can be used by other scripts.
array-utils-test.sh
: Test array utility.array-utils.sh
: Utilities for array operations.logger-test.sh
: Test logging utility.logger.sh
: A logging utility.usage-example.sh
: A practical demonstration of how to utilize the functions and utilities provided in thelogger.sh
andarray-utils.sh
.
-
4.docs: Additional documentation.
how-to-use.md
: Instructions on how to use the scripts.
To use these scripts, you'll need to have a Unix-like environment and a shell interpreter installed. You can clone the repository and navigate to the respective directories to find the scripts you're interested in.
Contributions are welcome! If you have an example script to share, please feel free to create a pull request.
If you have any questions or suggestions, feel free to open an issue on this repository or contact me directly at carelli.lc@gmail.com.
Happy scripting!