A collection of simple and useful Bash shell scripts for beginners and Linux users.
These scripts demonstrate basic Linux shell scripting concepts like loops, conditions, user input, and file handling.
.
├── for_loop_example.sh
├── while_loop_example.sh
├── sum_of_numbers.sh
└── README.md
Make sure you have Bash installed (most Linux distributions already include it).
Check your Bash version:
bash --version-
Clone this repository:
git clone https://github.com/<your-username>/<your-repo-name>.git cd <your-repo-name>
-
Give execute permissions to the script:
chmod +x script_name.sh
-
Run the script:
./script_name.sh
#!/bin/bash
for i in {1..5}
do
echo "Number: $i"
done#!/bin/bash
value=1
while [ $value -le 5 ]
do
echo "Number: $value"
((value++))
done#!/bin/bash
read -p "Enter num1: " num1
read -p "Enter num2: " num2
sum=$(($num1 + $num2))
echo "Sum: $sum"forloopswhileloops- Reading user input (
read) - Arithmetic operations
- File reading and manipulation
- Conditional statements (
if,elif,else)
Contributions are welcome! If you’d like to add new scripts or improve existing ones:
- Fork the repo
- Create a new branch
- Commit your changes
- Submit a pull request 🚀
This project is licensed under the MIT License.
Your Name 💼 GitHub: @your-username 📧 Email: your.email@example.com
---