This index / glossary / quick-reference lists many of the important topics covered in the text. Terms are arranged in approximate sorting order, reshuffled as necessary for enhanced clarity.

Note that commands are indexed in Part 4.

* * *

^ (caret) Beginning-of-line, in a Regular Expression

~ Tilde

= Equals sign

< Left angle bracket

> Right angle bracket

| Pipe, a device for passing the output of a command to another command or to the shell

|| Logical OR test operator

- (dash)

; (semicolon)

: Colon, null command, equivalent to the true Bash builtin

! Negation operator, inverts exit status of a test or command

? (question mark)

// Double forward slash, behavior of cd command toward

. (dot / period)

' ... ' (single quotes) strong quoting

" ... " (double quotes) weak quoting

() Parentheses

[ Left bracket, test construct

[ ]Brackets

[[ ... ]] Double brackets, extended test construct

$ Anchor, in a Regular Expression

$ Prefix to a variable name

$( ... ) Command substitution, setting a variable with output of a command, using parentheses notation

` ... ` Command substitution, using backquotes notation

${ ... } Variable manipulation / evaluation

\ Escape the character following


# Hashmark, special symbol beginning a script comment

#! Sha-bang, special string starting a shell script

* Asterisk

% Percent sign

+ Plus sign

* * *

Shell Variables

$_ Last argument to previous command

$- Flags passed to script, using set

$! Process ID of last background job

$? Exit status of a command

$@ All the positional parameters, as separate words

$* All the positional parameters, as a single word

$$ Process ID of the script

$# Number of arguments passed to a function, or to the script itself

$0 Filename of the script

$1 First argument passed to script

$9 Ninth argument passed to script

Table of shell variables

* * * * * *

-a Logical AND compound comparison test

Advanced Bash Scripting Guide, where to download


And list

Angle brackets, escaped, \< . . . \> word boundary in a Regular Expression

Anonymous here document, using :

Arithmetic expansion

Arithmetic operators


awk field-oriented text processing language

* * *

Backquotes, used in command substitution

Base conversion, example script



Basic commands, external

Batch processing

bc, calculator utility

Bison utility

Bitwise operators

Blocks of code

Brace expansion

Brackets, [ ]

Brackets, curly, {}, used in

break loop control command

Builtins in Bash

* * *

case construct

cat, concatentate file(s)

Child processes

Colon, : , equivalent to the true Bash builtin

Colorizing scripts

Comma operator, linking commands or operations

Command substitution

Comment headers, special purpose

Commenting out blocks of code

Compound comparison operators

continue loop control command

Control characters

C-style syntax , for handling variables

Curly brackets {}

* * *

Daemons, in UNIX-type OS

dc, calculator utility

dd, data duplicator command

Debugging scripts

Decimal number, Bash interprets numbers as

declare builtin

Default parameters

/dev directory

dialog, utility for generating dialog boxes in a script

$DIRSTACK directory stack

Disabled commands, in restricted shells

do keyword, begins execution of commands within a loop

done keyword, terminates a loop

DOS batch files, converting to shell scripts

DOS commands, UNIX equivalents of (table)

dot files, "hidden" setup and configuration files

Double brackets [[ ... ]] test construct

Double quotes " ... " weak quoting

Double-spacing a text file, using sed

* * *

-e File exists test


elif, Contraction of else and if

esac, keyword terminating case construct

Environmental variables

-eq , is-equal-to integer comparison test

Escaped characters, special meanings of

$EUID, Effective user ID

eval, Combine and evaluate expression(s), with variable expansion

exec command, using in redirection

Exit and Exit status

Export, to make available variables to child processes

expr, Expression evaluator

Extended Regular Expressions

* * *

false, returns unsuccessful (1) exit status

File descriptors


Filter, feeding output back to same filter

Floating point numbers, Bash does not recognize

fold, a filter to wrap lines of text

Forking a child process

for loops


* * *

getopt, external command for parsing script command-line arguments

getopts, Bash builtin for parsing script command-line arguments

Globbing, filename expansion

-ge , greater-than or equal integer comparison test

-gt , greater-than integer comparison test

$GROUPS, Groups user belongs to

* * *

Hashing, creating lookup keys in a table

head, echo to stdout lines at the beginning of a text file

help, gives usage summary of a Bash builtin

Here documents

$HOME, user's home directory

$HOSTNAME, system host name

* * *

if [ condition ]; then ... test construct

$IFS, Internal field separator variable

Integer comparison operators

in, keyword preceding [list] in a for loop

Initialization table, /etc/inittab

Interactive script, test for

I/O redirection

Indirect referencing of variables


* * *

Job IDs, table

jot, Emit a sequence of integers. Equivalent to seq.

* * *


kill, terminate a process by process ID

killall, terminate a process by name

killall script in /etc/rc.d/init.d

* * *

-le , less-than or equal integer comparison test

let, setting and carrying out arithmetic operations on variables

Limit string, in a here document

$LINENO, variable indicating the line number where it appears in a script

Link, file (using ln command)

List constructs

Local variables


Logical operators (&&, ||, etc.)

Logout file, the ~/.bash_logout file


Loopback devices, in /dev directory

-lt , less-than integer comparison test

* * *

m4, macro processing language

$MACHTYPE, Machine type

Magic number, marker at the head of a file indicating the file type

Makefile, file containing the list of dependencies used by make command

Modulo, arithmetic remainder operator

Mortgage calculations, example script

* * *

-n String not null test

Named pipe, a temporary FIFO buffer

nc, netcat, a toolkit for TCP and UDP ports

-ne, not-equal-to integer comparison test

Negation operator, !, reverses the sense of a test

netstat, Network statistics

nl, a filter to number lines of text

Noclobber, -C option to Bash to prevent overwriting of files

null variable assignment, avoiding

* * *

-o Logical OR compound comparison test

od, octal dump

$OLDPWD Previous working directory


Options, passed to shell or script on command line or by set command

Or list

Or logical operator, ||

* * *

Parameter substitution

Parent / child process problem, a child process cannot export variables to a parent process


$PATH, the path (location of system binaries)

Perl, programming language

PID, process ID

Pipe, | , a device for passing the output of a command to another command or to the shell


Portability issues in shell scripting

Positional parameters

POSIX, Portable Operating System Interface / UNIX

$PPID, process ID of parent process

Precedence, operator

Prepending lines at head of a file, script example

Prime numbers

printf, formatted print command

/proc directory


Process substitution


Pseudo-code, as problem-solving method

$PWD, Current working directory

* * *

Question mark, ?


* * *

Random numbers


read, set value of a variable from stdin



Reference Cards

Regular Expressions

$REPLY, Default value associated with read command

Restricted shell, shell (or script) with certain commands disabled

return, command that terminates a function


* * *

Scope of a variable, definition

Script options, set at command line

Scripting routines, library of useful definitions and functions

Secondary prompt, $PS2

Security issues

sed, pattern-based programming language

select, construct for menu building

Semicolon required, when do keyword is on first line of loop

seq, Emit a sequence of integers. Equivalent to jot.

set, Change value of internal script variables

Shell script, definition of

Shell wrapper, script embedding a command or utility

shift, reassigning positional parameters

$SHLVL, shell level, depth to which the shell (or script) is nested

shopt, change shell options

Signal, a message sent to a process

Single quotes (' ... ') strong quoting

Socket, a communication node associated with an I/O port


source, execute a script or, within a script, import a file

Spam, dealing with

Special characters

Stack, emulating a push-down, Example script

Startup files, Bash

stdin and stdout


Strong quoting ' ... '

Stylesheet for writing scripts


su Substitute user, log on as a different user or as root

suid (set user id) file flag

Symbolic links


* * *

tail, echo to stdout lines at the (tail) end of a text file

tee, redirect to a file output of command(s) partway through a pipe


test command

Test constructs

Test operators

Timed input

Tips and hints for Bash scripts

$TMOUT, Timeout interval

tr, character translation filter

Trap, specifying an action upon receipt of a signal

Trinary operator, C-style

true, returns successful (0) exit status

typeset builtin

* * *

$UID, User ID number

unalias, to remove an alias

uname, output system information

Uninitialized variables

uniq, filter to remove duplicate lines from a sorted file

unset, delete a shell variable

until loop

until [ condition-is-true ]; do

* * *


* * *

wait, suspend script execution

Weak quoting " ... "

while loop

while [ condition ]; do

Whitespace, spaces, tabs, and newline characters


* * *

xargs, Filter for grouping arguments

* * *


* * *

-z String is null

Zombie, a process that has terminated, but not yet been killed by its parent