Shell Programming
Unix Shells Intruduction
Shell Programming Examples


Unix Shells Intruduction
Bourne shell (sh) lacks job control, but it has good support for shell programming and is standard on all Unix systems; we'll study this one.
Korn shell (ksh) is an extension of sh; it is suitable for both interactive use and shell programming. Bash (Bourne-again shell) is a clone of the Korn shell.

Csh introduced job control. It is good for interactive use, but it is bad for writing shell scripts (e.g. nested ifs don't always work). It's like C syntax.

Tcsh is an enhanced but completely compatible version of the Berkeley UNIX C shell. It is a command language interpreter usable both as an interactive login shell and a shell script command processor. It includes a command-line editor, programmable word completion, spelling correction, a history mechanism and job control.

Handbook:
O'Reilly Learning the Bash Shell
O'Reilly Lerning the Korn Shell
O'Reilly Using csh & tcsh


Script Examples:
  1. Monitoring a certain process 

  2. A lot of important processes must be runing day by day,
    such as Oracle dbwr & dblg. This script is to check if a
    certain process is running, if not, sends message to admin
    by schedule.
  3. Full Backup script for Oracle data 

  4. This script is for full backup data and then save as to tape on unix.
    Incremental backup is similar.
  5. Find core and delete 

  6. This script is easy to find core files in your system and remove it.
  7. Check password

  8. This script is to check for No Password accounts, Never logged into
    accounts and easily guessable accounts.
  9. Auto-check file systems' size and send a warning to admin

  10. This script is to check the file systems whose size is greater than a certain
    threshold and sends an E-Mail to the root by schedule.
  11. Check all of disks to summary size then send a warning to admin

  12. If a disk is over size, data will not put in, however,  the system admin cann't
    find this issue timely, it will be a bad result for users. This script is to summary
    all disks size in your system and counts the free disks space automatically,  then
    reports to admin by schedule.
  13. Kill certain processes