Bash

Share

What is Bash?

Bash [gnu.org/software/bash/] is a shell found in most Linux distributions. If you open a terminal on Linux Mint, for example, the commands you type in the terminal are sent to be executed by Bash. Note that Bash and the terminal are different programs, e.g. you could have GNOME Terminal or XFCE Terminal showing you the terminal window for you to type, but in both cases the program that interprets those commands is Bash.

Bash-Less Distros

Most Linuxes have Bash, and because Bash is part of GNU, most Linuxes are said to be GNU/Linux operating systems. However, it's also possible to have a different shell. For example, Alpine Linux comes with Busybox instead of Bash, simply because Busybox is smaller than Bash and Alpine Linux is designed to be used in hardware with severe limitations.

Beware of writing shell scripts that are actually Bash scripts! Bash has some scripting features that other shells may not have, so a shell script that has the shebang #!/bin/sh and does anything complex may break unexpectedly mid-script. Use #!/usr/bin/env bash to fail faster.

In fact, I recommend avoiding shell scripts whenever possible and just using a more complete programming language like Python.

Not Linux, but BSDs may not come with Bash either. This is important because some web servers run BSD instead of Linux, so if you wrote a local shell script that you think is going to run in your web server, I have some bad news for you.

Linux® users are often surprised to find that Bash is not the default shell in FreeBSD. In fact, Bash is not included in the default installation. Instead, the Bourne shell-compatible sh(1) as the default user shell.

https://docs.freebsd.org/en/articles/linux-users/ (2024-10-03)

If you really want to use shell scripts instead of Python, you can try installing your server's BSD distro in a virtual machine or running it inside Docker.

Things to Know

What does Bash stand for?

Bash stands for Bourne Again SHell1.

References

Comments

Leave a Reply

Leave your thoughts! Required fields are marked *