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:
fatal: Not a git repository (or any of the parent directories): .git
I tried this:
var=$(git status)
But 'var' did not store anything.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…