Bash Command Substitution: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
Line 6: | Line 6: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
local content | local content | ||
content=$(ps -ef) | content=$(ps -ef) | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 00:03, 16 July 2017
Internal
Overview
Command substitution allows us to take the stdout output of a command or function, which would normally be sent to stdout of the executing shell, and save it as the value of a variable. To do this we place the command or the function within brackets, preceded by a $ sign.
local content
content=$(ps -ef)