list - 多命令之间无数据共享
; - 按顺序执行多个命令(无论命令是否执行成功)
Commands separated by a
;are executed sequentially; the shell waits for each command to terminate in turn. The return status is the exit status of the last command executed.
$ <command 1>; <command 2>
分号(;)是一个命令的结束符,使用分号可以在一行中执行多个命令:当前一个命令执行结束后,再执行下一个命令。
注意,使用分号时,下一个命令总是接着前一个命令执行完后就一定会执行(不管前一个命令执行成功或失败)。
而且,每一个命令都会作为当前 shell 的子进程来被执行。
$ echo "--";ll;echo "---"
--
total 16
-rw-r--r--@ 1 weishi wheel 5B 17 Sep 11:00 1
-rw-r--r--@ 1 weishi wheel 50B 17 Sep 11:08 2
---
$ clear; ls
上面例子中,Bash 先执行 clear 命令,执行完成后,再执行 ls 命令。
$ cat filelist.txt; ls -l filelist.txt
上面例子中,只要cat命令执行结束,不管成功或失败,都会继续执行ls命令。