Explain in your own words and examples, what is Shell Scripting for DevOps.
A shell script is a program that contains a sequence of shell commands that can be executed in a specific order to perform a particular task. it allows Devops to automate repetitive tasks and streamline the deployment and management of software applications.What is
#!/bin/bash?
can we write#!/bin/sh
as well?
#!/bin/bash
is called a shebang or hashbang. It is a special line that tells the operating system what program should be used to interpret the commands in the script. In this case,#!/bin/bash
indicates that the script should be interpreted by the Bash shell.Yes, it is possible to use
#!/bin/sh
as well.sh
is a simpler shell than Bash and it may be used in scripts where Bash-specific features are not required.Write a Shell Script which prints
I will complete #90DaysOofDevOps challenge
\>create a new file with the filename.sh
>vim filename.sh
\>To perform the insert operation in the editor pressi
#!/bin/bash
echo "I will complete #90DaysOofDevOps challenge"
\>To exit pressesc
\>To run the shell script first give the execution permission to the file
>chmod +x filename.sh
>./filename.sh
Write a Shell Script to take user input, input from arguments and print the variables.
To take input from users we have to use$1
for one argument and for n-number of args use$@
.Write an Example of If else in Shell Scripting by comparing 2 numbers