Thursday, December 8, 2016

Using case Structures

Control Structures in Scripts III

Using case Structures
The case statement is really just a glorified if/then statement. The if/then statement works perfectly if we have a condition that can be evaluated in one of two ways. In the preceding examples, the condition could be evaluated as true or false. However, what do you do if you have a condition that could be evaluated in many different ways, but you still want your script to take certain actions based on how it evaluates? You use the case statement instead.


case variable in

       response_1)
           commands ;;


       response_2)
           commands ;;


       response_3)
            commands  ;;

esac




LX0-104 Exam Objectives (F)

No comments:

Post a Comment