Skip to main content

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

Published 2 min readMarkdown

What is Linux Shell Scripting?

A shell script is a computer program designed to be run by a Linux shell, a command-line interpreter. The various dialects of shell scripts are considered to be scripting languages. Typical operations performed by shell scripts include file manipulation, program execution, and printing text.

Tasks

  • Explain in your own words and examples, what is Shell Scripting for DevOps.

    Shell scripting is widely used by developers to automate tasks within an operating system, enhance web pages within browser software, etc. With the use of shell scripting, you can reduce time rather than waste time on unnecessary time-consuming repetitive tasks.

  • shells scripts are interactive, they accept the command as input from users and execute them. Shell can also take commands from a file; we can write these desired commands in a file and can easily execute them in the shell to avoid repetitive work

  • What is #!/bin/bash? can we write #!/bin/sh as well?

    #!/bin/bash is called shebang or hashbang line. You need to use it at every start of the shell scripting it is the syntax. It is also indicated that the interpreter should execute the script.

  • Yes, it is also possible to use #!/bin/sh in place of #!/bin/bash to specify the interpreter as the Bourne shell. The Bourne shell is an older Unix shell that has a smaller feature set compared to bash.

  • Write a Shell Script that prints I will complete #90DaysOofDevOps challenge

  • Now, you need to give permission and run the command to print it.

    • Output:

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

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

  • Regards,

    Happy learning,

    Mohammed Muqafamuddin.

No comments yet. Be the first to comment.

More from this blog