/dev/null changes result, why? ( How to know if svn repository exists )
Because I am writing last few weeks some scripts for a project, I do want to put those under svn ( subversion ). As a scripting exercise I want to be able to create Repos and project folders in one go and add changes to the repo's svn conf files.
I want to check if there is already an existing repository and if the name=passw line is already added to the passw db.
I did use:
svnlook youngest /Volumes/Development/_svnRepo/SSHToolNew 2>&1 | grep "No such file or directory" -c
to check for the error message returned by svnlook
svnlook: Can't open file '/Volumes/Development/_svnRepo/SSHToolNew/format': No such file or directory
and want to continue doing my stuff when the result is bigger then 0, otherwise create the repo first with some options.
With the following info
/Volumes/Development/_svnRepo/SSHTools exists
/Volumes/Development/_svnRepo/SSHToolNew doesn't exists
using ( typed in the sh )
svnlook youngest /Volumes/Development/_svnRepo/SSHToolNew 2>&1 | grep "No such file or directory" -c
1
echo "rv:" $?
1
gives as result 1 in the shell and when using echo "rv:" $?
however
svnlook youngest /Volumes/Development/_svnRepo/SSHToolNew 2>&1 | grep "No such file or directory" -c &> /dev/null
echo "rv:" $?
0
gives 0 as result.
And when the folder do exists it return the opposite!?
Just to understands the happening. Why the difference with &> /dev/null ?
What do I mis here?