Skip to main content

Command Palette

Search for a command to run...

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

Published
•2 min read•View as Markdown
#Day 4 Task: Basic Linux Shell Scripting for DevOps Engineers.
K

work to ensure that code releases go smoothly, analyzing data for improvements and optimization. manage software development operations, implement engineering tools and use their process knowledge to streamline updates or creation.

1) What is shell Scripting for Devops?

Shell scripting is a combination of commands written to automate the Repetitive task. the shell script will be executed in the shell. shell is Command line interpreter and it is a bridge between the kernel and the user. kernel is the heart of OS having two types.

  • Mono for Linux

  • micro for windows

Advantages of shell scripting

  • The command and syntax are exactly the same as those directly entered in command line, so programmer do not need to switch to entirely different syntax

  • Writing shell scripts are much quicker

  • Quick start

Interactive debugging etc

2) What is #!/bin/bash?

#!/bin/bash : It is called as she-bang. It is used to instruct the operating system to use bash as a command interpreter./bin/bash is a more feature-rich shell that includes many additional features and extensions

3) Can we write #!/bin/sh as well?

Yes we can use #!/bin/sh. It is used to execute the file using sh, which is a Bourne shell, or a compatible shell.

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

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

#!/bin/bash
echo  "enter the name"
read name
echo "enter the surname"
read surname
echo "my name is $name $surname"

6) Write an Example of If else in Shell Scripting by comparing 2 numbers.

    #!/bin/bash
    num1=80
    num2=20
    if [ $num1 -gt $num2 ]
    then
      echo "$num1 is greater than $num2"
    else
      echo "$num2 is greater than $num1"
    fi

thanks for reading,

connect on Linkdin