- Learning Linux Shell Scripting
- Ganesh Naik
- 162字
- 2021-06-25 22:02:53
Command1; command2
A command line can consist of multiple commands. Each command is separated by a semicolon, and the command line is terminated with a newline. The exit status is that of the last command in the chain of commands.
The first command is executed, and the second one is started as soon as the first one has finished:
$ w; date
Output:
$ w ; date > whoandwhen
Output from the date command will be redirected to the whoandwhen file.
In the preceding example, we can see that when we put multiple commands on the same line, but separated by the ; command, then those commands execute sequentially one by one:
$ date; who am i Tue Mar 10 23:21:38 PDT 201 student pts/0 2015-03-10 23:12 (:0.0)
In the preceding example, the date command is executed first and the who am I command will be executed next. Both the commands are typed on the same lines, separated by the ; command.
推薦閱讀
- 現代測控電子技術
- 構建高質量的C#代碼
- 機器人智能運動規劃技術
- 機器自動化控制器原理與應用
- 工業機器人工程應用虛擬仿真教程:MotoSim EG-VRC
- 80x86/Pentium微型計算機原理及應用
- 完全掌握AutoCAD 2008中文版:機械篇
- Mastering ServiceNow Scripting
- 液壓機智能故障診斷方法集成技術
- 計算機組成與操作系統
- 生物3D打印:從醫療輔具制造到細胞打印
- 基于Proteus的單片機應用技術
- Cloudera Hadoop大數據平臺實戰指南
- Embedded Linux Development using Yocto Projects(Second Edition)
- 51單片機應用程序開發與實踐