Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Why learn Bash?

Two main reasons:

  1. to To improve command line productivity
  2. to To write scripts

...

For command line productivity

The combination of piping, a large set of built-in utilities, and the ease of creating and troubleshooting long "command line one-liners" provides tremendous productivity potential over, for example, having to write a Python program to achieve equivalent results.

This Piping a Histogram discussion provides a good example.

...

For scripting

Because bash is an execution environment, it is uniquely well suited for executing a series of processing steps, often calling other programs or utilities, and integrating the results. Such scripts are sometimes termed pipeline scripts and can automate processes that consist of many sub tasks – for example, next-gen sequencing alignment pipeline scripts that go from raw reads (FASTQ files) to alignment reports (sorted, index BAM files), gathering statistics along the way.

A good 2nd choice Another possible programming language for writing pipeline scripts would be is Python, since it has a rich set of built-in features and can be easily extended. The downside of this choice is that it takes discipline to separate the scripting environment from Python program environments, which can lead to the creation of large, complex but fragile systems with many hidden dependencies.

These days, complex pipelines may be difficult to write in any single programming language; thus workflow managers are becoming increasingly popular. These tools allow the integrated orchestration of many different workflow components, potentially written in many different languages, managing their dependencies via rules (think make, on steroids), and can also be effectively deployed in cloud environments such as AWS and Google Cloud. Both Nextflow and Snakemake, two of the most popular workflow managers, support rule bodies written in bash.

Bash in the world

bash scripting is much in demand. And while it may not be loved by programmers, developers who know it are well compensated.

...