What is Kernel?
It is the part of the operating system that communicates directly with the computer's hardware and manages system resources.
What is Shell?
Shell is a command-line interpreter or a user interface for interacting with the operating system.
What is Shell Scripting for DevOps?
Shell scripting for DevOps is an important feature of DevOps. Shell Scripting is a file consisting of a sequence of commands to automate and streamline repetitive tasks.
What is #!/bin/bash? can we write #!/bin/sh as well?
#!/bin/bash is called a shebang or hashbang. It's the first line of a shell script and specifies the interpreter that should be used to execute the script.
Yes, you can also use #!/bin/sh
as a shebang, which indicates that the script should be interpreted by the system's default shell, which might be Bash or another compatible shell. However, using #!/bin/bash
is often preferred when writing Bash-specific scripts to ensure compatibility and specific features of the Bash shell.
Write a Shell Script which prints I will complete the #90DaysOofDevOps challenge
#!/bin/bash
echo "I will complete #90DaysOfDevOps challenge"
Write a Shell Script to take user input, input from arguments and print the variables.
#!/bin/bash
# Taking user input
echo "Enter your name: "
read rName
# Taking user input
echo "Enter your num: "
read num
echo "User input:"
echo "rName: $rName"
echo "num: $num"
Write an Example of If else in Shell Scripting by comparing 2 numbers
#!/bin/bash
# Taking user input for two numbers
read -p "Enter the first number: " num1
read -p "Enter the second number: " num2
# Comparing the numbers
if [ $num1 -eq $num2 ]; then
echo "The numbers are equal."
elif [ $num1 -gt $num2 ]; then
echo "The first number is greater than the second."
else
echo "The second number is greater than the first."
fi