Task: Basic Linux Shell Scripting for DevOps Engineers.

Task: Basic Linux Shell Scripting for DevOps Engineers.

Hello Everyone,
#day4
Basic Linux Shell Scripting for DevOps Engineers.
As a challenge #90daysofdevops under Shubham Londhe
#devops #90daysofdevops #trainwithshubham #awscloud #devopscommunity

What is Kernel?

In Linux, the kernel is the core component of the operating system that manages the system's resources, such as the CPU, memory, input/output devices, and network connections. It is responsible for providing an interface between the hardware and the software, allowing programs to communicate with the hardware without needing to understand the specifics of each device.

In short, the kernel is the heart of the Linux operating system, and it is responsible for managing the hardware resources and providing a stable and secure environment for running applications.

What is Shell?

A shell is a command-line interface that allows users to interact with the operating system and execute commands. The shell provides a way for users to enter commands, and then passes those commands to the operating system to be executed.

What is Linux Shell Scripting?

Linux shell scripting is the process of creating a series of commands and instructions, written in a scripting language, that can be executed in the Linux shell. It allows users to automate repetitive tasks, simplify complex processes, and perform system administration tasks.

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

    • The line #!/bin/bash is called a shebang or a hashbang, and it is used to specify the interpreter to be used for executing a script.

      In the case of #!/bin/bash, it specifies that the script should be executed using the Bash shell interpreter. This is the default shell in most Linux distributions, and it is widely used for shell scripting.

      When a script is executed, the operating system looks for the shebang line at the beginning of the file. If it finds one, it uses the specified interpreter to execute the script. If it doesn't find one, it assumes that the script is a binary executable and tries to execute it directly, which may cause errors or unexpected behavior.

      By using the shebang line, you can ensure that your script is executed using the intended interpreter, regardless of the default settings or environment variables of the system. This is particularly important when writing scripts that rely on specific features or syntax of a particular shell or interpreter.

    • Yes, you can write #!/bin/sh as a shebang in a script.

      In this case, the script would be executed using the default shell interpreter of the system, which is usually a POSIX-compliant shell, such as Dash or Bash in POSIX mode.

      However, it is worth noting that there are some differences between the Bash and POSIX shells, particularly in terms of syntax and features. If you rely on Bash-specific features in your script, using #!/bin/sh as a shebang may cause errors or unexpected behavior. Therefore, it is recommended to use the appropriate shebang for the interpreter that your script requires.

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

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