Skip to main content

Command Palette

Search for a command to run...

Basic Linux Shell Scripting for DevOps Engineers.

#90 Days of DevOps Challenge - Day 4

Published
•2 min read•View as Markdown
Basic Linux Shell Scripting for DevOps Engineers.
G

I am an aspiring DevOps engineer with a strong passion for learning and growing in this field. After being inspired by my roommate's journey from mechanical engineering to DevOps, I realized my own affinity for computers and decided to pursue this path towards success. Please guide me on this journey

  1. What is Shell Scripting for DevOps?

    Shell scripting refers to writing a script in a text file containing writing a script in a text file that contains a series of commands, which can be executed by the shell. These commands can automate tasks.

    For Example: Backing up files, Installing software, Cleaning up old files, Monitoring system resources, and Automating repetitive tasks.

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

    The #!/bin/bash is the starting line for our script, which serves as an instruction to the system on which shell to use to execute the script. In this case, the #!/bin/bash shebang indicates that the Bash shell should be used to run the script.

    Yes, we can also use #!/bin/sh in our shell script. It is another type of shell that can be used in a shell script. However, it is worth noting that Bash has more features and capabilities than the Bourne shell.

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

     #!bin/bash
     #This script uses the echo command to print the string.
     echo "#90DaysOofDevOps challenge"
    

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

#!/bin/bash

echo "Let me find your lucky number, Eneter you name"

read name

number=007

echo "Your name is $name, and  You Lucky number would be $number"
  1. Write an Example of If else in Shell Scripting by comparing 2 numbers.

#!/bin/bash
a=3
b=4
if [ $a >= $b ]
than
   echo " a is the greater than b "
else
  echo " b is not equal to a"
fi
#output:  a is greater than b