Following on from this question I've used the following command in a bash script:
find ${svn_root} -maxdepth 2 -type d -exec bash -c 'if svnlook info "$1" &>/dev/null ;then echo"$1" >>${log_file} ;svnadmin verify "$1" 2>>{log_file} ;fi' _ {} \;
Both variables are defined at the beginning of the script. The variable $svn_root is appropriately expanded, but the $log_file variable is not.
I see that the variable is not passed into any of the -exec bash -c
command, I assume that's because it's a subshell?
I can slip log_file=/path/to/log ;
in front of the echo
part of the line, but that kind of hard codes that part of the command, if I change the variable in the script without changing it within the find command I'll be outputting to two separate log files!
Can I import/export that variable into that subshell (if that's what it is)?