Unix shell scripting with ksh/bash
Text-only
Printable
Framed version
Introduction
Research Computing Home
1.
What is a shell script
2.
Why use shell scripts
Typical uses
3.
History
4.
Feature comparison
Core Similarities (and recap of basic command line usage)
Principal Differences
5.
Other scripting languages
6.
ksh/bash vs sh
7.
Basics
Exit status
8.
Filename Wildcards
9.
Variables
Setting and exporting variables
Using variables
Conditional modifiers
Variable assignment command prefix
10.
Preset Variables
Login environment
Shell internal settings
Process ID variables
ksh/bash additional features
11.
Arguments
Setting new positional arguments
12.
Shell options
13.
Command substitution
sh syntax
ksh/bash syntax
14.
I/O redirection and pipelines
Output redirection
Input redirection
Command pipelines
15.
Input and output
Script output
Script input
16.
Conditional Tests
File tests
Character string tests
17.
Conditional Tests (contd.)
Arithmetic tests
Additional tests for [[...]] (ksh and bash)
Negating and Combining tests
18.
Flow control
Conditional execution: if/else
Looping: 'while' and 'for' loops
19.
Flow control (contd.)
Case statement: pattern matching
Miscellaneous flow control and subshells
20.
Conditional test examples
21.
Miscellaneous
22.
Manipulating Variables
Text variables
Numeric variables
23.
Functions
Defining functions
Calling functions.
Reuseable functions
24.
Advanced I/O
Redirecting for the whole script
Explicitly opening or duplicating file descriptors
Input and output to open file descriptors (ksh)
Closing file handles
25.
Wizard I/O
Pass stderr of a command into a pipeline for further processing
Capture the exit status of a command in the middle of a pipeline
26.
Coprocesses
ksh coprocesses
27.
Arrays
28.
Signals
29.
Security
30.
Style
When not to use shell scripts
31.
Examples
32.
Common external commands
Listing, copying and moving files and directories
Displaying text, files or parts of files
Compression and archiving
Sorting and searching for patterns
System information (users, processes, time)
Conditional tests
Stream Editing
Finding and comparing files
Arithmetic and String Manipulation
Merging files
33.
References
Books
Online Resources
Unix-like shells and utilities for Microsoft Windows