I have an SVN repository. I have a shell/bash script that’s designed to automatically add all unversioned files to the repository. It looks like this:
svn status | grep '^?' | sed 's/^.* /svn add /' | bash;
Which works perfectly, except for when one of my new files has whitespace in the filename. How can I modify this command to deal with that?
To avoid quoting issues here, you should avoid the shell call altogether and use xargs instead, which will also speed up the process:
This will handle most special characters, but not work to escape newlines, but since these are the record separator for svn status and grep, you won’t get much better than that anyway.