View on GitHub

Computational Techniques for Life Sciences

BASH SCRIPTING

Course Objectives

This course is designed as an introduction to managing data on high performance computing clusters. It is intended to teach users to be self-sufficient and proactive in managing their own data in order to (1) increase their productivity, (2) maximize the usage of the existing storage, (3) decrease accidental or unintentional data loss, and (4) prevent disruption of the file system or compute nodes to the point where it may affect others. This course is intended for people who have beginner to intermediate familiarity with a command line interface, and have active accounts on a TACC HPC cluster.

This course is designed to build upon Introduction to Linux and Command Line Utilities

This course is divided into 2 sections of 6 modules:

Intermediate BASH

  1. BASH Scripts
  2. Variables
  3. Arithmetic
  4. Strings
  5. Arguments
  6. Arrays


Advanced BASH

  1. Loops
  2. IF/THEN/ELSE
  3. WHILE
  4. FOR
  5. CASE
  6. Subprograms/Functions

Instructional Objectives

This course should be taught in a room equipped with computers (or attendees with laptops) and internet access. Attendees should also have an existing allocation on a TACC resource. Attendees without an allocation can still participate in most components if they have a Mac / Linux laptop, or a Windows laptop with Putty installed and access to a Linux server.

Specific Learning Objectives

Module1

Module 1: bash script basics
 
Topics covered in this module:
• The basic format and construction of bash scripts

Module 1

Module 1: `bash` script basics
Topics covered in this module:
  • The basic format and construction of `bash` scripts
Attendees should be able to...
  • Use `vi` to create a script
  • Make the script executable using `chmod`


Module 2

Module 2: `bash` VARIABLES
Topics covered in this module:
  • The types and usage of variables and parameters
Attendees should be able to...
  • Identify and know the limits of different variables types in `bash`


Module 3

Module 3: ARITHMETIC
Topics covered in this module:
  • Arithmetic operations for both integer and floatng point variables
Attendees should be able to...
  • Perform basic arithmetic operations on variables


Module 4

Module 4: STRINGS
Topics covered in this module:
  • The construction and usage of character strings, substrings, and string parameters
Attendees should be able to...
  • Extract or modify the value of a string or substring


Module 5

Module 5: COMMAND LINE ARGUMENTS
Topics covered in this module:
  • Parameters that reference, control, and alter command line arguments for a script.
Attendees should be able to...
  • Identify and extract information passed to or from a `bash` script


Module 6

Module 6: ARRAYS
Topics covered in this module:
  • How to create and modify collections of common elements that form array.
Attendees should be able to...
  • Specify and modify entire arrays or just individual array elements


Module 7

Module 7: `bash` LOOPS overview
Topics covered in this module:
  • The different types and purposes of common `bash` loops.
Attendees should be able to...
  • Understand the role of different loop types.


Module 8

Module 8: IF/THEN/ELSE
Topics covered in this module:
  • The syntax and role for conditional comparisons.
Attendees should be able to...
  • Construct scripts that compare variables


Module 9

Module 9: WHILE LOOPS
Topics covered in this module:
  • The syntax and role for unbound loops
Attendees should be able to...
  • Construct scripts that perpetually run until a condition is met.


Module 10

Module 10: FOR LOOPS
Topics covered in this module:
  • The syntax and role for loops the over lists and ranges
Attendees should be able to...
  • Construct scripts the execute commands for each member of a list or range


Module 11

Module 11: CASE STATEMENTS
Topics covered in this module:
  • How to assess when the values of a looped list are known and what actions should be taken.
Attendees should be able to...
  • Design scripts that allow them to contruct hierarchical menu-like responses.


Module 12

Module 12: SUBFUNCTIONS
Topics covered in this module:
  • creation of reusable code blocks
Attendees should be able to...
  • Construct scripts that reuse common repetitive functions


Prev BASH scripting Next BASH scripts UP : BASH scripting Top : Course Overview


© 2017 Texas Advanced Computing Center