[SOLVED] zsh: Find parent of searched file or directory and execute a command there
by blueray from LinuxQuestions.org on (#54BDG)
My sub-directory has multiple .git repo. To Find them I am using:
Code:[Documents/antora]$ echo **/.git
demo-component-a/.git demo-component-b/.gitNow I actually need the parent directories. demo-component-a & demo-component-b.
I found this neat feature to find the parent of a path:
Code:$ var=/home/blueray/Documents/antora/demo-component-b
$ echo $var:h
/home/blueray/Documents/antoraNow I am trying to combine these two to run the command git commit -am "Latest Commit" in both directories.
What can be the solution here?


Code:[Documents/antora]$ echo **/.git
demo-component-a/.git demo-component-b/.gitNow I actually need the parent directories. demo-component-a & demo-component-b.
I found this neat feature to find the parent of a path:
Code:$ var=/home/blueray/Documents/antora/demo-component-b
$ echo $var:h
/home/blueray/Documents/antoraNow I am trying to combine these two to run the command git commit -am "Latest Commit" in both directories.
What can be the solution here?