Constructs
You
In Linux, the shell includes features that allow you to use it as a programming language. 0u
can use these features to execute shell scripts that perform complex operations. One sUCh
feature is aconstruct. You can use constructs for looping and decision making in shell
scripts. In this chapter, you will learn about the following two constructs:
" if
case
, The if Construct
based on
At times, you might need to check for a specific condition and execute commands
whether the status of the condition is true or false. In such cases, you can use the if
nstruct. The if construct is typically used in conjunction with the test command.
Syntax
The syntax forthe if construct is as follows:
if ccondition>
then <command(s)>
[else <command(s)> ]
If the result is true, then the
The if construct evaluates a given conditional expression.
false, the statements are
statements following the if construct are executed. If the result is
used to indicate the end of
skipped and the control moves to the else statement. Here, fi is
the construct.
You
In Linux, the shell includes features that allow you to use it as a programming language. 0u
can use these features to execute shell scripts that perform complex operations. One sUCh
feature is aconstruct. You can use constructs for looping and decision making in shell
scripts. In this chapter, you will learn about the following two constructs:
" if
case
, The if Construct
based on
At times, you might need to check for a specific condition and execute commands
whether the status of the condition is true or false. In such cases, you can use the if
nstruct. The if construct is typically used in conjunction with the test command.
Syntax
The syntax forthe if construct is as follows:
if ccondition>
then <command(s)>
[else <command(s)> ]
If the result is true, then the
The if construct evaluates a given conditional expression.
false, the statements are
statements following the if construct are executed. If the result is
used to indicate the end of
skipped and the control moves to the else statement. Here, fi is
the construct.