Unix Decision Making
Unix Decision Making
While writing a shell script, there may be a situation when you need to adopt one path out of the given two paths. So you need to make use of conditional statements that allow your program to make correct decisions and perform right actions. Unix Shell supports conditional statements which are used to perform different actions based on different conditions. Here we will explain following two decision making statements:
Most of the if statements check relations using relational operators discussed in previous chapter.
case...esac statement
Unix Shell's case...esac is very similar to switch...case statement we have in other programming languages like C or C++ and PERL etc.