Javatpoint Logo
Javatpoint Logo

Double Vertical Bar (||)

The command shell interprets the (||) as the logical OR. This is opposite of logical AND. Means second command will execute only when first command will be a failure.

Example:

Linux Double Vertical Bar1

Look at the above snapshot, by listing the Desktop, you can see there is a file 'exm' (We have highlighted it just to point it out). Now, we have given the command "rm exm || file jtp.txt ; echo yes". On passing this command, 'file jtp.txt' has not been executed because first command has sucessfully deleted 'exm'.

Now, again we have passed the same command "rm exm || file jtp.txt ; echo yes" and now second command 'file jtp.txt' is executed successfully.






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA