- Published on
A rant about shells
- Authors
- Name
- ディーン・タリサイ
- @prjctimg
Introduction 📜
Shell scripting languages come in many flavours and picking one can be a daunting task. I have taken the liberty to try out most of them, and to be honest they all do the same thing generally speaking. However, that's an understatement because they offer slightly (or wildly) different syntax and some shells integrate better with certain environments.
NOTE
To be clear, it is important to note that a shell interpreter is needed to run the scripting language. Any interpreted language can be run as a script by using the #!
directive at the first line of the file to specify the interpreter to use (for example bun
or python
, bash
) and making it executable.
By looking at a shell from this perspective makes it easier to think about (task) automation.
PS ~ You can't do this with compiled languages.
Reasons for choosing one shell over another may include:
- POSIX compliancy
- Native integration with particular programming languages or environments
- Interactivity support i.e command hints and auto-completion
- Availability on the targeted platform(s)
- Syntactical preferences (loops and control flow in
bash
looks weird) - Support for working with certain tools or terminal features.
- Legacy reasons
For each shell we'll look at the following topics:
- Development history/motivation
- Novel features introduced/improved
- Integrations with other tools
- Syntax
- Escape codes
- Strengths and limitations
- Setting up and configuration (keybindings,
PATH
, prompts, etc)
[!info]
I haven't covered PowerShell because my current platform isn't supported yet (
aarch64-gnu-linux
) 🥲. The shells are listed in chronological order (from what I found). I may have unintentionally skipped a few shells, you can leave a PR with suggestions and I will (may) add it to the list.
IMPORTANT
/etc/shells
0. dash🗿
1. csh📜
csh
is a command language interpreter with a C-like syntax. It is used both as interactive login shell and a shell script command processor.
2. tcsh🧙🏾
tcsh
is an enhanced but completely compatible version of the Berkeley UNIX C shell, csh
. It is a command language interpreter usable both as an interactive login shell and a shell script command processor.
3. ksh🌽
ksh
is a command and programming language that executes commands read from a terminal or a file. rksh
is a restricted version of the command interpreter ksh;it is used to set up login names and execution environments whose capabilities are more controlled than those of the standard shell.
4. bash🦬
bash
is an sh
-compatible command language interpreter that executes commands read from the standard input or from a file. Bash also incorporates useful features from the Korn and C shells (ksh
and csh
).
5. zsh🦍
zsh
is
6. fish🐟
fish
is a command-line shell written mainly with interactive use in mind.
7. xonsh 🐍
8. elvish🧝🏾
Elvish is an expressive programming language and a versatile interactive shell, combined into one seamless package.
9. nushell🧮
10. ion🦀
Ion is a modern system shell that is written entirely in Rust, features a simple (and powerful) syntax, and offers performance that exceeds the level of Dash.
11. oil 🪔 ()
I hope you have as much fun reading this as I had writing it!