From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/bash/command-substitution.html | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 devdocs/bash/command-substitution.html (limited to 'devdocs/bash/command-substitution.html') diff --git a/devdocs/bash/command-substitution.html b/devdocs/bash/command-substitution.html new file mode 100644 index 00000000..d7993680 --- /dev/null +++ b/devdocs/bash/command-substitution.html @@ -0,0 +1,12 @@ +

Command Substitution

Command substitution allows the output of a command to replace the command itself. Command substitution occurs when a command is enclosed as follows:

+
$(command)
+
+

or

+
`command`
+
+

Bash performs the expansion by executing command in a subshell environment and replacing the command substitution with the standard output of the command, with any trailing newlines deleted. Embedded newlines are not deleted, but they may be removed during word splitting. The command substitution $(cat file) can be replaced by the equivalent but faster $(< file).

When the old-style backquote form of substitution is used, backslash retains its literal meaning except when followed by ‘$’, ‘`’, or ‘\’. The first backquote not preceded by a backslash terminates the command substitution. When using the $(command) form, all characters between the parentheses make up the command; none are treated specially.

Command substitutions may be nested. To nest when using the backquoted form, escape the inner backquotes with backslashes.

If the substitution appears within double quotes, word splitting and filename expansion are not performed on the results.

+

+ Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
Licensed under the GNU Free Documentation License.
+ https://www.gnu.org/software/bash/manual/html_node/Command-Substitution.html +

+
-- cgit v1.2.3