- Bash Quick Start Guide
- Tom Ryder
- 211字
- 2021-07-23 16:58:57
Running commands in sequence
You can send an interactive command line with more than one simple command in it, separating them with a semicolon, one of several possible control operators. Bash will then execute the commands in sequence, waiting for each simple command to finish before it starts the next one. For example, we could write the following command line and issue it in an interactive Bash session:
$ cd ; ls -a ; mkdir New
For this command line, note that even if one of the commands fails, Bash will still keep running the next command. To demonstrate this, we can write a command line to include a command that we expect to fail, such as the rmdir call here:
$ cd ; rmdir ~/nonexistent ; echo 'Hello' rmdir: failed to remove '/home/bashuser/nonexistent': No such file or directory Hello
Note that the echo command still runs, even though the rmdir command before it did not succeed. If you want your set of commands to stop if one of them fails, separating them with semicolons is the wrong choice.
- Oracle SOA Governance 11g Implementation
- Hands-On Internet of Things with MQTT
- CorelDRAW X4中文版平面設計50例
- 人工智能與人工生命
- Maya極速引擎:材質篇
- 新手學電腦快速入門
- 傳感器與新聞
- Red Hat Linux 9實務自學手冊
- Visual Studio 2010 (C#) Windows數據庫項目開發
- Windows安全指南
- WOW!Photoshop CS6完全自學寶典
- Machine Learning with Spark(Second Edition)
- Oracle 11g Anti-hacker's Cookbook
- WPF專業編程指南
- 軟測之魂