Check that an svn repository url does not exist

后端 未结 6 1146
别那么骄傲
别那么骄傲 2021-02-01 12:47

I am writing a script which will add a new project in the repository, based on the name supplied by the user. Part of this involves checking that an url with the same name does

6条回答
  •  盖世英雄少女心
    2021-02-01 13:37

    Instead of checking for return strings I would just check for the return code:

    both

    svn ls REPOSITORY/PATH
    

    and

    svn info REPOSITORY/PATH
    

    return 0 if all went fine, and 1 if things went wrong; you can quickly check it out:

    echo $?
    

    so in a bash script just do something like:

    error=$?
    if [ $error -ne 0 ]; then
          YOUR ERROR HANDLING
    fi
    

    works like a treat!

提交回复
热议问题