User Tools

Site Tools


skill-tree:use:1:2:b

USE1.2 Shell Scripts

The shell provides a programming language that allows you to write programs (known as shell scripts), which helps to combine commands into more complex applications.

Despite initially seeming cumbersome and inefficient to many, the real power of shell scripting quickly becomes apparent to those who use it. Everyday use is to automate repetitive tasks, which would otherwise be time-consuming to complete.

This skill covers the bash shell.

Requirements

Learning Objectives

  • Create a basic shell script that executes a sequence of programs.
  • Design a script using the bash construct “if” that handles conditional execution based on:
    • Performing a test for the existing of a file/directory,
    • Testing for the presence of certain text in a file,
  • Design a script that performs a task repeatedly using the bash “for” or “while” loop.
  • Utilize debugging options for troubleshooting of shell programs:
    • Options to bash: -e, -x
  • Use shell functions to break large, complex sequences, into a series of small functions.
  • Learn how to manipulate filenames.
  • Learn to manage temporary files:
    • Choose an adequate file system (or top directory) for temporary files.
    • Automatically generate a unique folder name for temporary files.
    • Automatically delete temporary folder whenever the script exits.

Subskills

skill-tree/use/1/2/b.txt · Last modified: 2024/09/11 12:30 by 127.0.0.1