What command would execute cmd1 followed by cmd2, regardless of the exit status of cmd1?

What command would execute cmd1 followed by cmd2, regardless of the exit status of cmd1?

What command would execute cmd1 followed by cmd2, regardless of the exit status of cmd1?

A.
cmd1 cmd2

B.
cmd1 | cmd2

C.
cmd1 ; cmd2

D.
cmd1 && cmd2

E.
cmd1 || cmd2

Explanation/Reference:
You can concatenate as many commands as you want by separating them with a semi-colon.
A) cmd1 cmd2 would tell the shell that cmd2 is a parameter of cmd1
B) pipe the output of cmd1 to cmd2
D) && would check the exit code of cmd1 and only start cmd2 if cmd1 was successful
E) || would check the exit code of cmd1 and only run cmd2 if cmd1 was not successful



Leave a Reply 0

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