What is Bash?

Bash, the Bourne-Again Shell, refers to both a specific UNIX shell and an associated scripting language. It was initially written for the GNU project and first released in 1989 and is the default shell of Linux and Apple’s macOS as well as now is distributed in the Windows 10 Anniversary Update! Just as a note, the name of the shell ‘Bourne-again shell’ is punned on the name of the Bourne shell that it replaced and also on the term ‘born again’, point to the spiritual re-birthing in the American Christianity.

Due to the fact that it is a commanding language and processor, it runs inside text windows where the commands are needed to be typed. Along with that, Bash also reads comments from any file and supports globbing, command substitution and control structures, and so on. It is mainly a POSIX (Portable Operating System Interface) shell with a number of extensions and is also Unix’s sh-compatible, which incorporates the important features from C shell (csh) or Korn shell (ksh).

Bash can be useful in various ways to a user

For example,

  • Instead of typing one Linux command at a time, a script in the bash shell can run an entire set of commands at once. This way we can person specific tasks by sparing ourselves from the efforts to typing repetitive commands over and over again.

  • Typical programming languages are well-suited for a set of detailed operations that are not readily accomplished by Bash. However, a Bash script is preferred when it is desired to make use of the existing programs by letting them to do the heavy lifting which are chained together in a particular manner to achieve the desired result. Bash works as glue logic to make the general purpose tools work together.

  • An example scenario would be to call a multiple number of MATLAB, R and SPSS scripts from Bash where the outputs are feed from one to another while, performing some prepossessing at each stage.

Bash in Data Sciences

There are numerous examples of practical data mining works that will have a flow of importing specific data resources into flat text-type files. Bash can run different programs on those files, clean, optimise and extract preliminary views of the data. There is one part of data mining, which involves unstructured data and then transforming it into a structured one. A scripting language like Bash can be very useful for doing the transformation. For example. Bash is preferable to Hadoop (a popular framework for distributed storage and processing of very large data sets using the MapReduce programming model, further discussed later in this book) because scripts in Bash translate well into Hadoop.

Get hands-on with 1200+ tech skills courses.