Command substitution

Computer simulation, one of the main cross-computing methodologies.

Facility that allows a command to be run and its output to be pasted back on the command line as arguments to another command.

- Command substitution

9 related topics

Relevance

Bourne shell

Shell command-line interpreter for computer operating systems.

Bourne shell interaction on Version 7 Unix
Version 7 Unix: the original Bourne shell manual page. PDP-11 simulation with SIMH
Interaction with pdksh in OpenBSD (default shell)

Command substitution using backquotes:.

C shell

Unix shell created by Bill Joy while he was a graduate student at University of California, Berkeley in the late 1970s.

tcsh and sh side-by-side on a Mac OS X desktop
C Shell running on Windows Services for UNIX
64-bit Hamilton C shell on a Windows 7 desktop.

Like all Unix shells, it supports filename wildcarding, piping, here documents, command substitution, variables and control structures for condition-testing and iteration.

Pipeline (Unix)

Mechanism for inter-process communication using message passing.

A pipeline of three program processes run on a text terminal

To remedy this issue, the "pipemill" can instead be fed from a here document containing a command substitution, which waits for the pipeline to finish running before milling through the contents.

Unix shell

Command-line interpreter or shell that provides a command line user interface for Unix-like operating systems.

tcsh and sh shell windows on a Mac OS X Leopard desktop

All Unix shells provide filename wildcarding, piping, here documents, command substitution, variables and control structures for condition-testing and iteration.

Bash (Unix shell)

Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell.

Screenshot of a Bash session
Screenshot of a Bash session

Like most Unix shells, it supports filename globbing (wildcard matching), piping, here documents, command substitution, variables, and control structures for condition-testing and iteration.

Here document

File literal or input stream literal: it is a section of a source code file that is treated as if it were a separate file.

Computer simulation, one of the main cross-computing methodologies.

Some shells treat them as a format string literal, allowing variable substitution and command substitution inside the literal.

Metacharacter

Character that has a special meaning to a computer program, such as a shell interpreter or a regular expression engine.

tcsh and sh shell windows on a Mac OS X Leopard desktop

In some Unix shells and MS-DOS/Windows Command Prompt, the less-than sign and greater-than sign ("<" and ">") are used for redirection and the backtick/grave accent ("`") is used for command substitution.

Backtick

Typographical mark used mainly in computing.

Typewriter with French (AZERTY) keyboard:,, , have dedicated keys; the circumflex and diaeresis accents have dead keys.
Italian typewriter (QWERTY keyboard) with dead keys for acute, circumflex, diaeresis and grave accents.

Many of the Unix shells and the programming languages Perl, PHP, and Ruby use pairs of this character to indicate command substitution, that is, substitution of the standard output from one command into a line of text defining another command.

Make (software)

Build automation tool that automatically builds executable programs and libraries from source code by reading files called Makefiles which specify how to derive the target program.

Screenshot of GNU Make, an implementation of Make

Macros can be composed of shell commands by using the command substitution operator, denoted by backticks (`).