Day 4: DevOps ❤️

Task: Basic Linux Shell Scripting for DevOps Engineers.

  1. Explain in your own words and examples, what is Shell Scripting for DevOps.

    Shell scripting is just like a program or code which performs a certain task and helps to automate a particular task.

  2. What is #!/bin/bash? can we write #!/bin/sh as well?

    #/bin/bash is a shebang line used in shell scripting files to set bash, present in the '/bin' directory, as the default shell for executing commands present in the file.

  3. Write a Shell Script that prints I will complete #90DaysOofDevOps challenge

     #!/bin/bash 
     echo "I will complete #90DaysOofDevOps challenge"
    

    Steps to execute the above file:

    1. chmod 700 file_name.sh

    2. ./file_name.sh

  4. Write a Shell Script to take user input, input from arguments and print the variables.

     #!/bin/bash
     NAME=$1
     echo $NAME
    
  5. Write an Example of If else in Shell Scripting by comparing 2 numbers

     #!/bin/bash
    
     if [[ 2 -gt 10 ]]
     then
       echo "The variable is greater than 10."
     else
       echo "The variable is equal or less than 10."
     fi
    

    Bye GIFs - Get the best gif on GIFER