Chapter 6. Command execution order

When executing commands, you occasionally need to know that one command has completed successfully or failed before carrying on with another command. For example, suppose you wanted to copy all the files from one directory to another directory, then delete the source directory. You’ll want to know for sure that the copy went OK first before you blitz the original directory, otherwise you could lose all your source directory contents.

In this chapter we will cover:

  • command execution control; and

  • command grouping.

The shell has a couple of commands that will not execute the second commands unless the first went OK or execute the second command if the first one failed. The operators that can take care of these ...

Get Linux and Unix Shell Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.