Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Using Commands To Generate A... > Deferred Command Substitution

12.3. Deferred Command Substitution

In the most direct form of command substitution, the output of a command that generates arguments is substituted immediately into the command that uses the arguments. The strategy of saving the arguments in a file and inserting the file's contents into another command decouples argument generation from argument use, which in effect defers command substitution. This method was used in the previous section for reasons of efficiency (to avoid running a lengthy find command more than once), but the method is useful in other situations as well. For example, you can examine the argument list to check it, or to modify the list before passing it to another command. These techniques are discussed below.

12.3.1. Verifying the Argument List

You should not always put a backquoted command directly into the command that uses its output. The argument-generating command might produce unexpected output, or no output at all, as discussed below.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint