If Condition in Unix


If Condition in Unix:

  •  If condition in Unix should start with “if” and end with “fi”.
  •  Every script should start with “#!/bin/sh” as mentioned below.

 $1 in the below script says that the first argument.

If the first argument given while executing the script is “Red”, then it will print as Nethra else it will print as Sanjay. See below the details.

If, elif in Unix:

    Below is the syntax of If, Else if, Else condition in Unix.

Please see below the results of the execution.


Like it? Please Spread the word!