Skip to content

velocityswastik99-droid/shellscript_code

Repository files navigation

🐚 Shell Script Collection

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.


📂 Project Structure


.
├── for_loop_example.sh
├── while_loop_example.sh
├── sum_of_numbers.sh
└── README.md


🚀 Getting Started

🧰 Prerequisites

Make sure you have Bash installed (most Linux distributions already include it).

Check your Bash version:

bash --version

▶️ Running the Scripts

  1. Clone this repository:

    git clone https://github.com/<your-username>/<your-repo-name>.git
    cd <your-repo-name>
  2. Give execute permissions to the script:

    chmod +x script_name.sh
  3. Run the script:

    ./script_name.sh

💡 Example Scripts

🔁 for_loop_example.sh

#!/bin/bash
for i in {1..5}
do
  echo "Number: $i"
done

🔄 while_loop_example.sh

#!/bin/bash
value=1
while [ $value -le 5 ]
do
  echo "Number: $value"
  ((value++))
done

➕ sum_of_numbers.sh

#!/bin/bash
read -p "Enter num1: " num1
read -p "Enter num2: " num2
sum=$(($num1 + $num2))
echo "Sum: $sum"

🧠 Concepts Covered

  • for loops
  • while loops
  • Reading user input (read)
  • Arithmetic operations
  • File reading and manipulation
  • Conditional statements (if, elif, else)

🤝 Contributing

Contributions are welcome! If you’d like to add new scripts or improve existing ones:

  1. Fork the repo
  2. Create a new branch
  3. Commit your changes
  4. Submit a pull request 🚀

🪪 License

This project is licensed under the MIT License.


👨‍💻 Author

Your Name 💼 GitHub: @your-username 📧 Email: your.email@example.com


---

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published