Command output to variable in bash

From Attie's Wiki
Jump to: navigation, search

Ever wanted to capture the output of a command into a variable in bash? It's simple!

variable=$(command)

date=$(date)
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox