I am writing a shell script that gets me the status of a directory in svn then loops through it and either adds or deletes the files.
This svn command
$ svn status /myLocalDir/files
returns files i have either added or deleted locally. ? = add, ! = deleted
! /myLocalDir/files/deletedPicture.png
? /myLocalDir/files/addedPicture.png
Im using a loop in my bash script (see below). What i need to do is, when i loop through my root directory of the files/folders that have been either added, or deleted, I need to
A. print out “Deleting” [X] or “Adding” [X]
B. Determine based on the first char (?,!) if I should delete or add the current file in the loop to svn.
Im just not sure the syntax of how to parse the string “! /myLocalDir/files/deletedPicture.png” to do that
for X in `svn status /myLocalDir/files | cut -c 8-300`
do
if [ "!" ]
then
echo "Deleting " $X
#svn $CREDENTIALS delete $X
else
echo "Adding " $X
#svn $CREDENTIALS add $X
fi
done
one other thing i am noticing.. even thought svn status in the command line
! /myLocalDir/files/deletedPicture.png
? /myLocalDir/files/addedPicture.png
my bash loop echo’s like this
!
/myLocalDir/files/deletedPicture.png
?
/myLocalDir/files/addedPicture.png
Thanks for all the input!! but this is what i went with.. all i really needed to do was determine base on the first char of a string which was delete and which was add so I substring’d it. I replaced the spaces with dashes which solved my for looping issue and then I substring each one for my condition