Problem scenario: You know how to assign variables in a Bash script. But how do you assign the output of a complex command such as this?
cat foo.txt | grep continual | grep integration | uniq
To push the output of some compound statement into a text file is simple. Sometimes you want to redirect everything to a variable. How do you do this?
Solution: Use $(expression)
varA=$(cat foo.txt | grep continual | grep integration | uniq)
Remember that there cannot be spaces around the equal sign. Later call varA like this to evaluate it for its content: $varA