Home » Linux Double Ampersand

Linux Double Ampersand

by Online Tutorials Library

Linux Double Ampersand (&&)

The command shell interprets the && as the logical AND. When using this command, the second command will be executed only when the first one has been succcefully executed.

Example:

Linux Double Ampersand1

Look at the above snapshot, both the commands are successfully executed.

Let’s see an example of failed command.

Example:

Linux Double Ampersand2

Look at the above snapshot, in first case “rmdir sample && ls” is successfully executed but in the second case directory ‘sample’ was already removed and hence second command ‘ls’ is failed and not executed.

You may also like