In Linux use use AND Operators and it is represented by (&). In commands we can either use (&&) or (;). So, does a semi Colon (;) is also called an AND Operator?
Asked
Active
Viewed 384 times
1
-
Most likely duplicate of: https://unix.stackexchange.com/q/159513/237982 – jesse_b May 12 '20 at 15:15
-
So, a semi-colon is called a "List Terminator"? – Salman Ahmed May 12 '20 at 15:21
1 Answers
5
No, a semicolon is not a boolean operator. It is however, just like &&
, &
, and newlines, a command terminator, marking the end of a command.
The difference between
cmd1; cmd2
and
cmd1 && cmd2
is that in the first case, cmd2
will always execute after cmd1
has terminated, while in the second case, cmd2
only executes if cmd1
terminated with a zero exit status (signalling "success").
With
cmd1 & cmd2
cmd1
is started as a background job (an asynchronous task), and cmd2
is started immediately after starting cmd1
(the two would run concurrently).
Both &
and ;
are called "list separators", separating lists of commands. In the POSIX shell grammar, they are called "separator operators".

Kusalananda
- 333,661
-
Yes, I know its functionality. Actually I am looking for terminology for semi-colon. – Salman Ahmed May 12 '20 at 15:22
-
1@SalmanAhmed This was not clear from the question, but I've added it to the answer. – Kusalananda May 12 '20 at 15:25
-
-
@glennjackman I'm sure it does. The main thing is that
;
is not an "AND operator". – Kusalananda May 12 '20 at 16:11