Day 4: DevOps ❤️
Table of contents
Task: Basic Linux Shell Scripting for DevOps Engineers.
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.
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.
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:
Write a Shell Script to take user input, input from arguments and print the variables.
#!/bin/bash NAME=$1 echo $NAME
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