Bash a Unix Shell Language

Introduction

There are several good reasons why you should learn Bash (or another shell e.g., Zsh). The greatest advantages comes in terms of efficiency and flexibility.

Automate boring stuff: Bash versus Python?

At the book Automate the Boring Stuff’s web page the introduction starts with:

If you’ve ever spent hours renaming files or updating hundreds of spreadsheet cells, you know how tedious tasks like these can be. But what if you could have your computer do them for you?

When it comes to automating the boring stuff you can do a lot with shell scripting and in certain situations it can be stronger than e.g. Python (and sometimes much weaker).

The shell is good when it comes to piping, redirection, stdin, stdout, stderr, etc. Since Bash is design to talk to the OS there are several fantastic features that makes your life easier. I recently had to automate some scripting on a server. Data was pushed to the server and needed resampling before entering a database. I had Python scripts that resampled the data, but I wanted it to happen not once but continuously as data streamed in. Here Bash provided some nice ways to link the scripts together and set it up with Crontab (job scheduler).

Bash is clearly good at automating things that has to do with the OS. But Python has modules such as glob and os that can handle much of the same issues. So when to use Bash and when to use e.g. Python? I guess it boils down to taste and the task at hand.

Here are some quotes:

New to Bash?

If you are new to Bash I’d recommend the book the Linux Command Line.

Also FullBashGuide is a good resource.

How to learn Bash?

There are several programs that can be used in the CLI to learn more about the shell. Specifically useful programs are,

Command Description
help Reference page for shell builtin
man Display Commands manual page
tldr Simplified man pages

Terminal emulators

A terminal emulator is a program that allows you to use the terminal with some more advanced features. On Windows I e.g., use cmder which looks more appealing and has features such as multiple tabs. A Unix alternative would e.g., be the GNOME Terminal or rxvt.

This article gives a good overview over terminal emulators. Also, here’s a list from Arch wiki.

Difference between shells

Bash is the most common Unix shell language, it is as many other shells an extension of the Bourne shell. There are several other shells as well e.g., the fish shell (friendly interactive shell) which aims at providing a user friendly shell.

UNIX shell differences and how to change your shell (Monthly Posting)

Hyperpolyglot – Unix Shells: Bash, Fish, Ksh, Tcsh, Zsh

Various system shells

Wikipedia – Comparison of command shells

Csh Programming Considered Harmful