I have recently tried locate from findutils in cygwin. I wanted to use updatedb to create a file name database. And I wanted to exclude all the files and directories under .svn directories . So I tried updatedb --localpaths='D:/gnu/ws/ctre/space' --findoptions='-path "*/.svn" -prune -o'. But I could't exclude the files in .svn directories with this command. I am not very experienced with bash. But I wanted to solve this problem. So I checked update script and did some debugging to it. The problem is that bash shell will do pathname expansion to "*/.svn". My first fix is to add set -f in updatedb script. It works.
Then I wanted to open a bug for this script. For opening a bug, I need to do further investigation. So I learned more about bash and try more scripts. Finally, I found that I can use updatedb --localpaths='D:/gnu/ws/ctre/space' --findoptions='-path */.svn -prune -o' or updatedb --localpaths='D:/gnu/ws/ctre/space' --findoptions='-path '*/.svn' -prune -o'. Bash shell will preserve the literal value of every chacter within the qoutes. But bash shell will do expansion to characters enclosed by double quotes.
As a result, I did not open an invalid bug. I have learned more. It tells me that contributing to community will let me learn more.
Sometimes I was frustrated during this hacking. But the overall experience is good.
No comments:
Post a Comment