I've tried to write a function that includes bash command. I want to assign the output of the command to variable in my python I mean, the function gitCheck find the directory of my git Repository and assign it to gitRep but It gives me only 0. Is there anyone to know how could I do that ? Thanks in advance
def gitCheck():
reference_repositories_path="cat $HOME/.git_reference_repositories | sed 's/GIT_REFERENCES_PATH=//'"
gitRep=os.system(reference_repositories_path)
print gitRep
output
should be /home/gwapps/Desktop/GIT_REFERENCE_REPOSITORIES
but it gives me 0