# Difference Between sh and Bash in Linux?

Bash is a BourNeSh (Bourne Again ShEl) which is an improved variant oF thE origiNal Bourne shEll.It is used to run programs in the Bash programming language, and is often referred to as "the default shell" for Linux distributions. Sh is a simple commandinterpreter for the UNIX System V Release 4.0. Both Bash and sh can be used to write scripts in various languages such as Perl, Python, Ruby, PHP, Java, C++, JavaScript, Tcl, SQL, and others.

## sh

#!/bin/sh


## bash

#!/bin/bash


## Note

• A shell is an interface between the end-users and the operating systems.

• sh implements the shell command line interpreter.

• bash is a superset of sh.

## Sh

Bash is also known as the Bourne shell. sh is a command line shell program described by the POSIX standard. It works on Linux, Mac OS X, and BSD Unix-based operating systems. There are many different ways to implement it. On most operating systems (including Linux), sh is implemented by programs called "shells" like bash, zsh, and csh. Bash is a shell script interpreter. /bin/sh links to its main implementation. A symbolic link is a file that points to another file.

sh is not a computer programing language itself. sh is a detailed specification of the syntax and semantics for the shell programming languages. It doesn't include any code. sh is a shell built into most modern Linux distributions.

We can use sh as it has compatibility with multiple operating systems. Bash scripts will usually work just fine if they're written for bash too, even though bash isn't backward compatible with sh. sh is the most widely used scripting language for POSIX/UNIX/LINUX operating system platforms. One benefit of sh is that it exists on every Unix system.

## bash

Bash is also a command programming languages like sh.Bash is now the default user logon shells on Linux-based operating systems.Bash is an extended version of the sh command line interpreter for the GNU alternatives for the Bourne sh shell.

We can also say that bash is a programming language too. We can start Python in an interactive session and it behaves just like a command line interface (CLI) but we can also execute Python scripts from within any text editor.

bash is a superset of sh. This means bash supports the functions of sh and adds additional functionality. Although most commands work the same way as sh, bash is not a POSix compliant command line interpreter. It is a dialect (a subset) of the POSIX command line interface. Bash can run in an interactive terminal and allow users to execute commands. It has the best feature set of the Bourne-Again SHell family of languages, including file redirection, process substitution, environment variable expansion, history expansion, arithmetic evaluation, command grouping, and much more.

Like GNU software, such as GNU coreutils, which provides other shells, including implementation of csh, the Bourne Again SHell, is the standard Unix shell. Bourne Again SHell is designed to be compatible with the original AT&T UNIX System V Release 4.0 BSD operating system. Like other GNU, Bourne Again SHell was developed to be portable across multiple platforms. This means that it can run on any computer running the appropriate operating system.

## Difference between sh and bash

bash sh
Bourne Again SHell SHell
#!/bin/bash #!/bin/sh
Developed by Brain Fox Developed by Stephen R. Bourne
Successor of sh Predecessor of bash
bash is the default SHELL sh is the not default SHELL
supports job controls. does not support job control.
bash is not a valid POSIX shell. sh is a valid POSIX shell
Bash scripting is scripting specifically for Bash Shell scripting is scripting in any shell
supports command history. does not support command history.

## Conclusion

We've seen in this tutorial some head to head top differences between sh and Bash command in Linux.