Day 4 Task: Basic Linux Shell Scripting for DevOps Engineers.

Day 4 Task: Basic Linux Shell Scripting for DevOps Engineers.

ยท

2 min read

This is #90DaysofDevops challenge under the guidance of Shubham Londhe.

Day 4 TASK

Introduction:

In the world of DevOps, understanding Linux shell scripting is like having a superpower for automating tasks and managing systems. Let's explore the basics in simple terms to unlock the magic of shell scripting.

Getting to Know Kernel and Shell

The kernel is like the boss of an operating system. It controls everything, like how programs run and how they talk to the hardware.

Now, think of the shell as your friendly assistant. It's the link between you (the user) and the boss (the kernel). You tell the shell what you want to do, and it makes sure the boss understands.

What is Linux Shell Scripting?

Linux shell scripting is like writing down a set of instructions for your assistant (the shell) to follow. These instructions can do lots of things, like moving files around, running programs, and showing messages.

Let's Dive into Tasks

  1. Shell Scripting for DevOps: Shell scripting in DevOps is about making your assistant (the shell) do things automatically. It's like giving it a list of chores to do without having to ask every time.

  2. Understanding #!/bin/bash: When you see "#!/bin/bash" at the top of a script, it tells your assistant (the shell) which language to use to understand your instructions. It's like speaking the same language.

  3. Shell Script for 90DaysOfDevOps Challenge:

     bashCopy code#!/bin/bash
     echo "I will complete #90DaysOfDevOps challenge"
    

  4. Shell Script for User Input and Arguments:

     #!/bin/bash
     # User Input
     echo "Enter your name: "
     read name
     echo "Hello, $name!"
    
     # Arguments Input
     echo "First argument: $1"
     echo "Second argument: $2"
    

  5. Illustrating If-Else in Shell Scripting:

     #!/bin/bash
     # Comparing Two Numbers
     num1=5
     num2=10
    
     if [ $num1 -gt $num2 ]; then
         echo "$num1 is greater than $num2"
     elif [ $num1 -lt $num2 ]; then
         echo "$num1 is less than $num2"
     else
         echo "Both numbers are equal"
     fi
    

Conclusion:

In short, getting the hang of basic Linux shell scripting is like empowering your trusty helper (the shell) to work smarter, not harder. It's like having a reliable sidekick in your DevOps adventures, making tasks feel effortless!

I trust you found this guide on learning Shell scripting for DevOps engineers both enjoyable and valuable. If you did, please consider following and giving it a clap ๐Ÿ‘ to show your support ๐Ÿ˜„.

Thank you for reading! ๐Ÿ’š

ย