SOFTWARE ENGINEERING

EMERGING TRENDS IN SOFTWARE ENGINEERING

DEVOPS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following is correct syntax as per shell script?
A
if(Condtion){logic}
B
if(condtion)thenlogicfi
C
if[condtion]thenlogicfi
D
if[condition]{logic}
Explanation: 

Detailed explanation-1: -Use the break statement to exit a while loop when a particular condition realizes. The following script uses a break inside a while loop: #!/bin/bash i=0 while [[ $i-lt 11 ]] do if [[ “$i” == ‘2’ ]] then echo “Number $i!” break fi echo $i ((i++)) done echo “Done!"

Detailed explanation-2: -The if statement starts with the if keyword followed by the conditional expression and the then keyword. The statement ends with the fi keyword. If the TEST-COMMAND evaluates to True, the STATEMENTS gets executed. If TEST-COMMAND returns False, nothing happens; the STATEMENTS get ignored.

There is 1 question to complete.