Shell Scripting

Shell Scripting

·

1 min read

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

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

#! is called a SHEBANG.This represents which interpreter a script should be interpreted with .

#!/bin/bash This is a header command which represents it is a bash/shell script #!/bin/bash is this is not provided it often considers #!/bin/ sh which would be same in most cases. When you put #!/bin/bash in your script, even if you run the script in a different shell, the kernel will know which shell to interpret it with

Yes, we can use #!/bin/sh in our shell script should be executed by the default shell on the system.

  • Write a Shell Script which prints a valid user or invalid user :-

  • Output

    • Write a Shell Script which prints to add two numbers :-

    • Output

      • Write a Shell Script which prints to enter the directory name :-

  • Output