dEEpEst
☣☣ In The Depths ☣☣
Staff member
Administrator
Super Moderator
Hacker
Specter
Crawler
Shadow
- Joined
- Mar 29, 2018
- Messages
- 13,861
- Solutions
- 4
- Reputation
- 32
- Reaction score
- 45,552
- Points
- 1,813
- Credits
- 55,350
7 Years of Service
56%
Shells: from classics to innovations
Surely many people know the sh and bash shells. Most of us have also heard something about zsh and fish. However, the list does not end there.
Nowadays, there are many shells, but not all of them are used. Today we will consider the most basic examples and look at their key features.
The sh shell (Bourne shell)
This shell was written by Steve Bourne in 1977 and is the oldest of those known to the public.
The Bourne shell was the first full-fledged shell and contained the functionality that is now implemented by all current followers: using variables, executing commands and functions, and redirecting input and output.
Now sh is a link to the sh-compatible shell for a number of reasons:
In modern systems, the Bourne shell is no longer used as a user shell, but is useful as a command interpreter.
That's why it exists as a link, so as not to break compatibility for script execution. Do you still remember about shebang?)
Bash shell (Bourne again shell)
It was developed within the GNU project as an improved implementation of the Bourne shell in 1989.
The main creators of bash are Brian Fox and Chet Ramey. The name can be translated as "Bourne shell reborn". Most likely, the most popular shell today.
This shell is the successor of sh and significantly expands its functionality. However, it is still ancient and not as beautiful and configurable as the newer zsh and fish.
Zsh shell (Z shell)
A free modern sh-compatible shell, created in 1990. It has a number of advantages over bash, mainly concerning work in interactive mode.
Zsh supports autocompletion, typo correction, syntax highlighting, and quite a powerful configuration of appearance and functionality through themes and plugins.
However, zsh is fully revealed only through configuring configs. When you first run it, you will probably ask yourself: Why do you need it at all - the same bash... Yes, you need to manually configure it.
A highly recommended addition to the zsh shell is the "OH MY ZSH (
)" framework, which is designed to manage zsh settings and expand its functionality through plugins and themes.
Fish shell (friendly interactive shell)
Fish is not such a "bearded" shell. The first version dates back to 2005. Against the background of its main colleagues in the shop, which were released in the last century, fish (
) is a fresh cucumber.
If you need more functionality than bash, but you don't want to dig into configs like with zsh, you can consider this shell.
Everything would be fine, but there is a nuance: fish is a POSIX-incompatible shell. This means that the rules dictated by the POSIX standard for a number of shells (bash, zsh, etc.) have no effect on fish.
Example. This is how we define local variables in bash and zsh:
Let's try to repeat the same in fish:
This won't work here. In fish, variables are defined as follows:
Get the idea yet? If you write a script in fish-specific syntax and try to run it through a bash, sh or zsh interpreter, it will probably crash with an error.
Surely many people know the sh and bash shells. Most of us have also heard something about zsh and fish. However, the list does not end there.
Nowadays, there are many shells, but not all of them are used. Today we will consider the most basic examples and look at their key features.
The sh shell (Bourne shell)
This shell was written by Steve Bourne in 1977 and is the oldest of those known to the public.
The Bourne shell was the first full-fledged shell and contained the functionality that is now implemented by all current followers: using variables, executing commands and functions, and redirecting input and output.
Now sh is a link to the sh-compatible shell for a number of reasons:
Bash:
$ ls -l | grep sh
sh -> dash
In modern systems, the Bourne shell is no longer used as a user shell, but is useful as a command interpreter.
That's why it exists as a link, so as not to break compatibility for script execution. Do you still remember about shebang?)
Bash:
#!/bin/sh
Bash shell (Bourne again shell)
It was developed within the GNU project as an improved implementation of the Bourne shell in 1989.
The main creators of bash are Brian Fox and Chet Ramey. The name can be translated as "Bourne shell reborn". Most likely, the most popular shell today.
This shell is the successor of sh and significantly expands its functionality. However, it is still ancient and not as beautiful and configurable as the newer zsh and fish.
Zsh shell (Z shell)
A free modern sh-compatible shell, created in 1990. It has a number of advantages over bash, mainly concerning work in interactive mode.
Bash:
$ sudo apt install zsh
Zsh supports autocompletion, typo correction, syntax highlighting, and quite a powerful configuration of appearance and functionality through themes and plugins.
However, zsh is fully revealed only through configuring configs. When you first run it, you will probably ask yourself: Why do you need it at all - the same bash... Yes, you need to manually configure it.
A highly recommended addition to the zsh shell is the "OH MY ZSH (
This link is hidden for visitors. Please Log in or register now.
Fish shell (friendly interactive shell)
Fish is not such a "bearded" shell. The first version dates back to 2005. Against the background of its main colleagues in the shop, which were released in the last century, fish (
This link is hidden for visitors. Please Log in or register now.
Bash:
$ sudo apt-add-repository ppa:fish-shell/release-3
$ sudo apt update
$ sudo apt install fish
If you need more functionality than bash, but you don't want to dig into configs like with zsh, you can consider this shell.
Everything would be fine, but there is a nuance: fish is a POSIX-incompatible shell. This means that the rules dictated by the POSIX standard for a number of shells (bash, zsh, etc.) have no effect on fish.
Example. This is how we define local variables in bash and zsh:
Bash:
$ MY_VAR="Hello"
Let's try to repeat the same in fish:
Bash:
$ MY_VAR="Hello"
fish: Unsupported use of '='. In fish, please use 'set MY_VAR "Hello"'
This won't work here. In fish, variables are defined as follows:
Bash:
$ set MY_VAR "Hello"
Get the idea yet? If you write a script in fish-specific syntax and try to run it through a bash, sh or zsh interpreter, it will probably crash with an error.