Q. Conditional statements को दर्शाने के लिये शैल programming लिखिये।Ans.Bash में निम्लिखित कंडीशनल स्टेटमेंट्स है –
<![if !supportLists]> 1) <![endif]> if..then..fi statement (Simple If)<![if !supportLists]> 2) <![endif]> if..then..else..fi statement (If-Else)<![if !supportLists]> 3) <![endif]> if..elif..else..fi statement (Else If ladder)<![if !supportLists]> 4) <![endif]> if..then..else..if..then..fi..fi..(Nested if) <![if !supportLists]> 1) <![endif]> Bash If..then..fi statementSyntax:if [ conditional expression ]then statement1 statement2Fi Example:
<![if !supportLists]> 2) <![endif]> Bash If..then..else..fi statement Syntax: If [ conditional expression ]then statement1 statement2else statement3 statement4Fi
Example:
<![if !supportLists]> 3) <![endif]> Bash If..elif..else..fi Syntax: If [ conditional expression1 ]then statement1 statement2elif [ conditional expression2 ]then statement3 statement4else statement5fi
Example:
<![if !supportLists]> 4) <![endif]> Bash If..then..else..if..then..fi..fi.. Syntax:
If [ conditional expression1 ]then statement1 statement2else if [ conditional expression2 ] then statement3fifi
Example: