Shell Scripts

Overview
  • A Shell Script is a file that contains LINUX commands.
  • When you execute the file, the commands are executed.
  • Typically the first line indicates what kind of script it is, for instance:
#!/bin/bash
#!/usr/bin/env python
#!/bin/csh
#!/usr/bin/perl
REMINDER: Which ones are on your system?

We will start writing some shell scripts as we go through the material, so let's get set up now:

  1. Under your HOME directory, create a directory called cmd.
  2. cd to that directory and do your work from there.
  3. Create a file called myll that has the command to do a long listing in the current directory.
  4. Change its permissions to 755.
  5. Execute it.
  6. Go home and execute it twice, once with a relative path and once with an absolute path.

Shell Programming Syntax

Basic Syntax       More Advanced Syntax

Lets Write Some Shell Scripts