Day 4 : Basic Shell Scripting for DevOps.

Day 4 : Basic Shell Scripting for DevOps.

  1. What is Shell Scripting for DevOps?

    Shell scripting is a programming language that can used to automate tasks in a Linux/Unix environment. In the context of DevOps, shell scripting is used to automate repetitive and streamline the development and deployment of applications.

    Here are some of the benefits of using shell scripting for DevOps:

    • Automate repetitive tasks to save time and improve efficiency.

    • Streamline the development and deployment of applications.

    • Improve the reliability and consistency of deployments.

    • Increase the security of your systems.

    • Make it easier to troubleshoot problems.

  2. What is #!/bin/bash?

    #!/bin/bash => It is known as a shebang line which is also known as a first-line shell script.

    It tells the operating system which interpreter to use to execute the script. In this case, the #!/bin/bash shebang line specifies that the Bash shell should be used to interpret the script.

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

    Yes, you can also write #!/bin/sh. The /bin/sh executable represents the system shell, which is usually a symbolic link pointing to the executable for whichever shell is the system shell. In most cases, the system shell is bash. Therefore, #!/bin/sh and #!/bin/bash are equivalent.

    However, it is generally recommended to use #!/bin/bash, as this will ensure that the script is executed with the most up-to-date version of the Bash shell.

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

    #!/bin/bash echo "I will complete the #90DaysOfDevOps challenge"

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

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

    first, create one devops.sh file.

    then write a shell script for if else in nano editor.

    Shell scripting, was it difficult?

    for beginner 'YES' is tricky because every space matter in scripting.