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:

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/Reference:
A) executes foo and bar regardless of exit codes
B) executes bar only if foo fails
D) % is used in trimming text in the shell



Leave a Reply 1

Your email address will not be published. Required fields are marked *


liti

liti

Correct Answer: C