Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)

As per my knowledge using the & after the command is for running it in the background.

Example 

& usage: tar -czf file.tar.gz dirname &

But how about &&? 

1 Answer

0 votes
by (36.8k points)

Furthermore, you also have || which is the logical or, and also; which is just a separator that doesn't care what happened to the command before.

Oops, fail

$ true || echo "Will not be printed"

$  

$ true && echo "Things went well"

Things went well

$ false && echo "Will not be printed"

$

$ false ; echo "This will always run"

This will always run

Come and join Linux training to gain great knowledge. 

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Nov 29, 2020 in Linux by blackindya (18.4k points)

Browse Categories

...