title: How do I store the output of a git command in a variable?
body: <p>What I want is to store the output of a git command (such as git status) inside a variable in a shell script. When I say output, I am talking about the text returned in the terminal on execution of a command, for example:
  on doing a git status outside my repo:</p>
  
  <pre><code>fatal: Not a git repository (or any of the parent directories): .git
  </code></pre>
  
  <p>I tried this:</p>
  
  <pre><code>var=$(git status)
  </code></pre>
  
  <p>But 'var' did not store anything.</p>