Shell Scripting (I): Prerequisites
The following are the prerequisites for the Shell Scripting (I) course. If you do not meet these prerequisites then you are likely to find it extremely difficult to follow this course, and we recommend that you do not attend the course until you do satisfy these prerequisites.
You can obtain the necessary knowledge to satisfy almost all of these prerequisites by attending the Unix System: Introduction course. However, if you attend the Unix System: Introduction course in order to meet these prerequisites, it is important that you PRACTICE what you have learnt BEFORE attending this course. This is because this course assumes not only that you have the relevant knowledge and skills, but also that you are actively familiar with them.
The Unix System: Introduction
course doesn't cover the less
and touch
commands.
It also doesn't cover every single one of the listed options for the various
commands given below. If you have gone on this course to meet the
prerequisites, or if you are unfamiliar with Linux systems, you should
experiment with all the commands listed below (and, where given, the various
options listed for that command) on a PWF Linux
system before attending this course.
Familiarity with the Unix/Linux command line and running simple commands
Familiarity with running commands with options (e.g. ls ‑l
)
and combining several command-line options (e.g. ls ‑lR
)
Familiarity with the concept of Unix file permissions
Familiarity with using wildcards (e.g. *
, ?
)
to specify file names (this is sometimes called filename expansion or
pathname expansion)
Familiarity with piping the output of one command into another (e.g.
ls | more
)
Familiarity with redirecting a command's input (e.g. more < filename
)
and output (e.g. ls > filename
)
Familiarity with running commands in the background (e.g.
ls > filename &
)
Familiarity with the concept of environment variables and with the
simple use of environment variables (e.g. setting the PATH
environment variable; using the export
command under the
bash
shell).
Familiarity with the following Unix/Linux commands and their most common
options:
(Note: the options listed below are for the GNU versions
of these commands - which are the versions normally found on Linux
systems - and other versions of these commands (notably those supplied
with Solaris) may not support all these options, or may behave differently.)
|
Display the contents of a file. |
|
|
Change the current directory. |
|
|
Change file or directory permissions. |
|
|
Copies files and directories. Options used in this course: |
|
|
If unable to open destination file for writing, remove it and try again, i.e. forcibly overwrite destination files |
|
|
Preserve mode, ownership and timestamp attributes of copied files (where possible) |
|
|
Copy directories (if any) recursively, i.e. copy their contents |
|
|
Display or set the system date and time. |
|
|
Display text. Useful options (some of which are used in this course): |
|
|
Enable interpretation of some special character sequences
(backslash escapes), such as |
|
|
Do not output a trailing newline. |
|
|
With no arguments, print the current set of environment variables. |
|
|
Put a variable in the shell's environment,
optionally setting it at the same time. This command only exists under
certain Unix/Linux shells, most notably the |
|
|
Display a file one screenful of text at a time. |
|
|
Find lines in a file that match a given pattern. The pattern is specified as a regular expression. |
|
|
List the contents of a directory. Useful options (some of which are used in this course) include: |
|
|
List one entry per line |
|
|
Show directory entries starting with |
|
|
Show directory entries starting with |
|
|
List directory name instead of its contents and do not follow symbolic links |
|
|
Use a long listing format that shows lots of information about each directory entry |
|
|
List subdirectories recursively, i.e. display their contents and the contents of any subdirectories within them, etc |
|
|
Make directories. Option(s) used in this course: |
|
|
Make parent directories if neccessary. Also, if the directory to be created already exists, do not regard this as an error. |
|
|
Display a file one screenful of text at a time.
On some Linux distributions the |
|
|
Moves or renames files and directories. Note
that if you move a file or directory from one filesystem to another, then
|
|
|
Do not prompt before overwriting destination files or directories |
|
|
Prompt before overwriting destination files or directories |
|
|
Show what is being done |
|
|
Deletes files or directories. Useful options (some of which are used in this course) include: |
|
|
Ignore non-existent files and do not prompt before removing files or directories |
|
|
Prompt before removing files or directories |
|
|
Do not operate recursively on |
|
|
Remove subdirectories (if any) recursively, i.e. remove subdirectories and their contents |
|
|
Show what is being done |
|
|
Remove empty directories. |
|
|
Change the timestamp of a file. If the file does not exist, create it with the specified timestamp (the default timestamp is the current date and time). |
|
|
Count the number of characters, words and lines in a file. Option(s) used in this course: |
|
|
Print the number of lines in the file (strictly speaking, print the number of newline characters in the file). |
The following are not prerequisites, as they are either explained during the course, or else are somewhat peripheral to it. However, those attending the course will find it helpful if they are already familiar with:
The Bourne-Again SHell (bash), version 2.05 or higher
The concepts of standard input, standard output and standard error
The concept of a program's exit status (also called its exit code, return code, return status, error code, error status, errorlevel or error level)
The concept of a symbolic link
(also known as a symlink or soft link) and the ln
command (which, when used with the ‑s
option,
creates symbolic links)
The mktemp
command,
which is used to safely make a temporary file or directory