The difference between && and &, | and || in linux

In linux, & and &&, | and || are introduced as follows:

& Means that the task is executed in the background, if you want to run redis-server in the background, there is redis-server &

&& means that the next command will be executed when the previous command is executed successfully, such as echo '1' && echo '2'

| Represents the pipeline, the output of the previous command is used as the parameter of the next command, such as echo'yes' | wc -l

|| means that the next command is executed after the previous command fails, such as cat nofile || echo “fail”

Guess you like

Origin blog.csdn.net/qq_30566629/article/details/109344768