Embedded Commands   «Prev  Next»
Lesson 2 Defining embedded execution
Objective Explain how embedded command execution works.

Defining embedded Execution in Unix

The shell will perform embedded execution on any section of a command that is surrounded by back quotes. Embedded execution uses the output of the embedded command as part of the text of a surrounding command. Here is an example command using embedded execution:
The back quoted command, the ls is run first and the output is assigned to the var1 variable.


The difference between embedded execution and redirection

Notice that this differs from redirection, where the output of one command is used as the input to another command. Redirection can be used to capture command output in a file, as in:

ls > file1

Two-step process of embedded execution

The ls command is run first and the output is assigned to the file named file1. Notice that with redirection, your command is processed once. With embedded command execution, your command goes through a two-step process.