Home » If then elif Shell Scripting

If then elif Shell Scripting

by Online Tutorials Library

Shell Scripting if then elif

A new if can be nested inside an elif.

Syntax:

Syntax of if then elif is shown in the snapshot below,

Shell scripting If then elif 1

Example if then elif:

We have shown the example of choosing color.

Condition:

Shell scripting If then elif 2

Look at the above snapshot, we have shown the script.

Shell scripting If then elif 3

Look at the above snapshot, on Red color it goes to if part, on Blue color it goes to elif part and on other colors it goes to else part.

Next Topicfor loop

You may also like