Welcome to the home page of the UNIX Shell Scripting SIB course. This repository contains all of the course material.
Course slides:
Exercise instructions:
- Exercises part 1: shell expansions
- Exercises part 2: arguments, loops and functions
- Exercises: FASTA to TSV converter project
Documentation:
- Course frequently asked questions
- Bash Programming Reference
- Bash koans
- A sysadmin's guide to bash scripting
Scripting allows shell users to automate repetitive tasks, improving reproducibility, reducing the risk of errors, freeing time, and avoiding boredom.
Bioinformatics analysis pipelines may involve dozens or hundreds of steps that are each carried out by different command-line programs: assembling these into scripts allows users to treat whole pipelines as if they were ordinary shell commands.
This course targets users who already have basic knowledge of interactive shell use, such as taught in the SIB's Introduction to Linux / UNIX and the Bash shell , and are interested in moving from interactive to automated tasks.
The course covers the following topics:
- Understanding command parsing and processing by the shell:
- Tokenizing.
- Command parsing.
- Expansions (brace, parameter, process substitution).
- Word splitting and the IFS.
- Globbing.
- Standard input/output re-directions.
- The main syntactic constructs of the Bash shell: tests, conditionals, loops and functions.
- String and arithmetic operations.
- Reading inputs and writing outputs.
- Passing and parsing command-line arguments and options to shell scripts.
- Using arrays.
- Assembling individual analysis steps into reproducible, automated pipelines.
Participants are expected be familiar with the basics of UNIX shells, in particular:
- Moving around the file system and creating/deleting directories:
ls,cd,mkdir,rmdir. - Understanding path names, i.e. what is the path to a file or a directory.
- Redirecting output to files or other programs:
>,>>and|operators. - Some familiarity with basic shell utilities such as
grep,cut,tr(no expert skills required). - Proficiency with a text editor (necessary to write/edit script files).
Notions of programming (in any language) will be useful, but are not essential. For a more detailed list of prerequisites, please see this document.
🔥 Important: please make sure perform the following environment setup before the start of the course.
The only technical requirement for the course is having a version of
bash >= 4.0 (released in 2009) installed on your computer.
If you need to install bash, please see the
setting-up your environment instructions documentation.