Original link: http://blog.sina.com.cn/s/blog_6238358c0100rzvd.html
For a single command execution I think most people are clear about executing a command on a command line. What about executing multiple commands on a single line, in fact, it's very simple, just add a special command symbol between the commands, and we routinely use 3 special command symbols.
1. [ ; ]
If the semicolon (;) is The delimited command executes continuously, and even the wrong command continues to execute the subsequent command.
[Email protected] etc]# LLD; echo "OK"; Lok
-bash:lld:command not found
Ok
-bash:lok:command not found
2. [ && ]
If the command is separated by && , then the command will continue to execute, but there is a wrong command in the middle that will not execute the subsequent command, yes, it will go straight to the end.
[[email protected] etc]# echo "OK" && lld&& echo "OK"
Ok
-bash:lld:command not found
3.[ | |]
If each command is double vertical Bar | | , then a command that encounters a successful execution stops executing the subsequent command, regardless of whether the subsequent command is correct or not. If the command that executes to the error is to continue execution of the latter command until the correct command is encountered.
[[email protected] etc]# echo "OK" | | echo "haha"
Ok
[Email protected] etc]# LLD | | echo "OK" | | echo "haha"
-bash:lld:command not found
Ok
Go Linux executes multiple commands on a single command line