sangkrit

Linux: Control Operators


Senicolon(;)- We can put two or more than two commands on same line by separating it with a semicolon (;) Here shell scans the line till it reaches semicolon. Each argument is executed in sequence by the shell waiting for each command to finish.
Ampersand (&)- In line ending with an ampersand (&) shell don’t wait for the command to finish. We get the shell prompt back and the command gets executed in the background. When the command completes its execution we get a message.
Dollar Question Mark ($?)- It is a shell parameter (here, not variable as you cannot assign any value to it). It stores the exit code of previous command.
Double Ampersand (&&)- Using && the next command gets executed if the first one succeeds. It returns a zero exit status.


Leave a Reply