Text-only Table of Contents (frame/ no frame)
(13) Command substitution Previous Top Next

Command Substitution

sh syntax

A command (plus optional arguments) enclosed in backticks is executed and the standard output of that command is substituted. If the command produces multiline output, the newlines are retained. If the resultant string is displayed, unquoted, using echo, newlines and multiple spaces will be removed.

ksh/bash syntax

This syntax is functionally the same as backticks, but commands can be more easily nested.
This is equivalent to `cat file`, but implemented internally for efficiency.

Example: ex3 display, text

Previous Top Next

command-subs.src  last modified Mar 11, 2005 Introduction Table of Contents
(frame/no frame)
(single file)
© Dartmouth College