IT 244: Introduction to Linux/Unix
Class 18

Today's Topics


New Material

Reading Assignment

You should have read chapter 8 of Sobell, The Bourne Again Shell.

Homework 8

I have posted Homework 8 here.

As usual, it will be due next Sunday at 11:59 PM.


Running a Startup File after a Change has been Made

Commands that are Symbols

( ) Runs whatever commands are enclosed in the parentheses in a sub-shell
$( )Command substitution:
runs the commands enclosed in the parentheses in a subshell and returns their value to the command line, replacing the dollar sign, the parentheses and everything in them with this value
(( ))Evaluates an arithmetic expression:
by default, Unix treats everything as text, but this command evaluates whatever it encloses as a numerical, rather than a string, expression
$(( ))Arithmetic expansion:
evaluates an arithmetic expression and returns its value at that place on the command line
[ ]The test command:
used to evaluate a boolean expression in constructs like if clauses
[[ ]]The conditional expression:
similar to [ ] but adds string comparisons

File Descriptors

Redirecting Standard Error

Shell Scripts

Making a Shell Script Executable

Specifying Which Version of the Shell Will Run a Script

Comments in Shell Scripts

New Material

Separating and Grouping Commands

| (pipe) and & (ampersand) as Command Separators

Continuing a Command onto the Next Line

Using Parentheses, ( ) , to Run a Group of Commands in a Subshell

The Directory Stack

dirs - Displays the Directory Stack

pushd - Pushes a Directory onto the Stack

popd - Pops a Directory off the Stack

Shell Variables

Creating a Shell Variable


Local Variables

Global Variables

Choosing the Scope of a Variable

Defining Global Variables

Keyword Shell Variables

Important Keyword Shell Variables

User-created Variables

env - Show All Global Variables