LPI Exam Questions

You wish to have bar execute if foo returns an exit status of 0 Select the correct command:

You have two shell scripts, foo and bar. You wish to have bar execute if foo returns an exit status of 0 Select the correct command:

A.
foo; bar

B.
foo || bar

C.
foo && bar

D.
foo % bar

Explanation:

&& ?Logical AND Operator || ?Logical OR Operator ! ?Logical NOT Operator Correct Answer is C
because first tried to execute foo. If foo executes without any error then executes bar. If any error
occurs in foo then exit from command.