(I have Ubuntu)
I have some git repositories here and there on my computer. So I want to have the status of all in one command. I found this answer How can I view all the git repositories on my machine? (@jmlane : for d in find / -name ".git"
; do cd $d/..; echo pwd
:; git status; echo; done )
But I have a lot of "Permission denied" messages. So I searched and found this answer How can I exclude all "permission denied" messages from "find"? but I don't know how to addapt it to my problem.
I tried find -name ".git" | grep -v "Permission non accordée"
but I have the same result as just find -name ".git"
:
find: «./.cache/dconf»: Permission non accordée
find: «./.dbus»: Permission non accordée
./Documents/these/programmes/programme_ccm/.git
./Documents/these/rapports/centralisation/.git
./Documents/these/rapports/Barberis_review_2016/.git
./Documents/these/rapports/biblio/.git
I tried find -name ".git" 2> grep -v "Permission non accordée"
with no result
But when I tried find -name ".git" | grep "Permission non accordée"
I obtain
find: «./.cache/dconf»: Permission non accordée
find: «./.dbus»: Permission non accordée
This worked fine on my machine:
find -name ".git" 2> /dev/null
It puts error-stream to the special file /dev/null, which is simpy voidness.
your code:
find -name ".git" 2> grep -v "Permission non accordee"
was about to redirect error output to file named grep in your working directory.