linuxbashshellsvnsvn-export

svn exports work on command line but not in shell script


I have been working on a shell script that performs some deploy tasks by checking files out from svn and calling a Jar. I have been using a test SVN url without issues for the development. I now need to test Tag deployments and suddenly svn is giving me problems when i try to build the url using input.

I am building the url like this:

    svnurl=$(echo ${template//[# ]/})
    svnurl=$(svn://0.0.0.1/models/tags/"$tag"/"$svnurl")
    urls=("${urls[@]}" $svnurl)

which is only slightly different to the working code:

    svnurl=$(echo ${template//[# ]/})
    urls=("${urls[@]}" $svnurl)
    svn export "$svnurl"

(basically I am taking the IP and tag directory out of the url-template).

now when i attempt to run my shell, instead of getting "export complete" , i get the following:

./deploy-files.sh: line 36: svn://0.0.0.1/models/tags/201407221642/ResponseA.xsl: No such file or directory
svn: '.' is not a working copy

When I run svn export svn://0.0.0.1/models/tags/201407221642/ResponseA.xsl in the terminal the file exports correctly. I have checked and the urls are identical. I cant reproduce the '.' is a working copy error no matter what I try.

note: svn export -q svn://0.0.0.1/models/tags/"$tag"/deploy-filelist.yml is used earlier in the script and that works fine

What could the cause be ?

Thanks

EDIT

more info on how the svn urls are built

urls=()
IFS=$'\n' yaml=($(cat deploy-filelist.yml))
for u in "${yaml[@]}"; do
    if [[ $u =~ url.* ]]
    then
        template=$(echo $u | sed -e 's/url://g'  -e 's/"//'  -e 's/"$//')
        svnurl=$(echo ${template//[# ]/})
        svnurl=$(svn://0.0.0.1/models/tags/"$tag"/"$svnurl")
        urls=("${urls[@]}" $svnurl)
        svn checkout "$svnurl"
    fi
done

I read each line from deploy-filelist.yml. if the line contains "url" i cut out the required String and add it to the template 'svn://....' part. The url is formed correctly as I can copy the error message and use it to export the file.


Solution

  • In this line:

    svnurl=$(svn://0.0.0.1/models/tags/"$tag"/"$svnurl")
    

    you are trying to execute the string, hence the "No such file or directory" error.

    You probably want to assign the value to string:

    svnurl=svn://0.0.0.1/models/tags/"$tag"/"$svnurl"
    

    or

    svnurl="svn://0.0.0.1/models/tags/$tag/$svnurl"