13,420
edits
Changes
→Using Control Flow Statements in Shell Scripts
Control Flow Statement are used to make your shell scripts more flexible and can adapt to changing situations.
The test Linux command is used to test conditions to see if they are TRUE (i.e. value zero) or FALSE (i.e. value non-zero) �so they can be used with control flow statements to control the sequence of a shell script.
You CANNOT use the > or < symbols when using the test command since these are redirection symbols. Instead, you need to use options when performing numerical comparisons.
Refer to the table below for test options and their purposes.
There are other comparison options that can be used with the test command such as testing to see if a regular file or directory pathname exists, or if the regular file pathname is –non-empty.
=INVESTIGATION 1: CREATING A SHELL SCRIPT=