skip to navigation skip to content
- Select training provider - (Researcher Development Programme (RDP))
Instructor-led course

Provided by: University Information Services - Digital Literacy Skills


This course is not scheduled to run.


[ Show past events ]



Register interest
Register your interest - if you would be interested in additional dates being scheduled.


Events available

Unix: Simple Shell Scripting for Scientists
Prerequisites


Description

This course is part of the Scientific Computing series.

No previous experience of shell scripting is required for this course; however some knowledge of the interactive use of the bash shell is a prerequisite (see Simple Shell Scripting for Scientists: Prerequisites for details).

This course introduces shell scripting in bash for scientific computing tasks. Day one introduces very basic shell scripts in bash which process the command line in a simple fashion. Day two covers how to write more advanced shell scripts in bash. Day three covers how to make one's shell scripts more robust.

At the end of each day one or more exercises are set. It is VERY IMPORTANT that attendees attempt these exercises before the next day of the course. Attendees should make sure that they have allowed themselves sufficient study time for these exercises between each day of the course.

Target audience
  • All current University members (departments and colleges)
  • Further details regarding eligibility criteria are available
Prerequisites
  • Knowledge of the interactive use of the bash shell as might be obtained by attending the "Unix System: Introduction" course: for details see Simple Shell Scripting for Scientists: Prerequisites
  • Familiarity with a plain text editor (e.g. Emacs, gedit, Pico, vi) on a Unix system as might be obtained from either the Emacs or vi Editor courses (also briefly covered on the "Unix System: Introduction" course).
Topics covered
  • What is a shell script and how does it work?
  • Writing very simple shell scripts
  • Writing more advanced shell scripts
  • Simple use of shell variables and parameters
  • Simple use of some shell builtin commands: cd, echo, exit, pwd, read, return, source, set, test
  • Shell flow of control constructs: for, if, while
  • The mktemp command
  • Shell functions
  • Command substitution
  • Arithmetic expansion
  • Pipelines
  • Handling filenames
  • Obtaining input from the keyboard/standard input
  • Redirecting standard output and standard error
  • Simple processing of the command line
  • Handling errors in shell scripts
  • Translating your task into a shell script
  • Structuring shell scripts
  • Testing and debugging shell scripts
Format

Presentations, demonstrations, practical exercises and home study.

Materials
Taught using

MCS Linux

Notes
  • Please ensure you can attend all three sessions.
  • Please ensure you set aside some time between sessions for attempting the exercise(s) set at the end of the previous session.
  • People requiring very advanced shell programming skills are recommended to learn Python instead. The "Programming: Python for Absolute Beginners" course may be of interest in this regard.
  • As this course is part of the Scientific Computing series, all the examples chosen are more relevant to scientific computing than system administration.
  • Those attending this course may find it useful - once they have completed this course - to have a look at the "Unix Systems: Further Commands" course notes as these notes introduce more sophisticated Unix commands that could be used in shell scripts.
Duration

Three half day sessions

Related courses
Themes

Events available