Leading on from this question, I'm trying to write a bash script which will recurse two directories from the directory containing my subversion repositories, checking whether directories are repositories. There will be a mix of directories and repositories, and some repos hiding in those sub-dirs.
Any Subversion repos discovered should have their name printed to an output file, followed by the output of svnadmin verify
.
I have the following snippet to check whether a directory is a repository:
svnlook info /path/to/repo >/dev/null
So I'm throwing away the svnlook
output, a return code of 0 indicates that it is indeed a SVN repo. I could use this snippet, in an if
statement to run svnadmin verify
if 0 is returned.
I've tried:
find /dir/containing/repos -maxdepth 2 -type d -exec bash -c 'if [ "svnlook info {} >/dev/null" = 0 ] ;then ;echo "{}" >>output.txt ;svnadmin verify "{}" >>output.txt ;fi' \;
Though I get the following warning for each directory found:
bash: -c: -line 0: syntax error near unexpected token ';'
I think I'm trying to unnecessarily cram it all into one find
command, which I'm getting wrong anyway. What would be the best way to structure this task?
&
insvnadmin verify "$1" &>>output.txt
to get what I wanted from the command, and used"$1"
to replace the/path/to/repo
part forsvnlook
. What does the_
do near the end of line? – Arronical Jul 23 '15 at 10:57