Skip to content

Amitabh-DevOps/Shell-script-examples

Repository files navigation

Beginner-Friendly Shell Script Examples

Welcome to the Shell Script Examples repository! This repository contains simple and beginner-friendly shell scripts to help newcomers get started with shell scripting.

Table of Contents

Introduction

This repository is designed to introduce beginner-level shell scripts. Each script is focused on a specific concept or functionality to help new learners understand the basics of shell scripting.

Getting Started

To run these shell scripts on your local machine, you'll need a Unix-based system (like Linux or macOS) or a Windows system with a bash shell (e.g., using Git Bash or Windows Subsystem for Linux).

Scripts Overview

Each script in this repository covers a fundamental topic or operation in shell scripting. Here's a brief overview of each one:

  1. addition-in-for-loop.sh - Demonstrates how to perform addition using a for loop.
  2. armstrong.sh - Checks if a number is an Armstrong number.
  3. average-of-three.sh - Calculates the average of three numbers.
  4. calc.sh - A basic calculator script that performs addition, subtraction, multiplication, and division.
  5. even-odd-in-for.sh - Determines if numbers in a loop are even or odd.
  6. even-odd.sh - Simple script to check if a number is even or odd.
  7. facto-while.sh - Calculates the factorial of a number using a while loop.
  8. max-in-three.sh - Finds the maximum of three numbers.
  9. max-in-two.sh - Finds the maximum of two numbers.
  10. palindrome.sh - Checks if a number is a palindrome.
  11. posi-neg-zero.sh - Determines if a number is positive, negative, or zero.
  12. reverse-of-no.sh - Reverses a given number.
  13. stud-grade.sh - Assigns grades based on marks.
  14. swap.sh - Swaps two numbers without using a third variable.
  15. voting-eligible.sh - Checks if a person is eligible to vote based on their age.

How to Use

To run a script, navigate to the repository folder and execute the script using sh:

sh script-name.sh

For example, to run the addition-in-for-loop.sh script, use:

sh addition-in-for-loop.sh

Make sure to give execute permissions if needed:

chmod +x script-name.sh

Contributing

If you would like to contribute additional beginner-friendly shell scripts or improve the existing ones, feel free to open a pull request. Ensure that the code is well-commented and easy for new learners to follow.

About

This repo contains begineer friendly SHELL SCRIPT EXAMPLES

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages