此脚本用于回滚svn

#!/bin/sh
version_list=$(svn log --limit 2|sed '1d'|sed '$d'|awk -F '|' '{print $1}'|awk -v RS="" '{gsub("\n","");print}') #找出最近的版本,并进行格式化
echo 'verions finding....'
echo $version_list  #版本号 最近两个
rocback_version=$(svn log --limit 2|tac |sed -n 4p|awk '{print $1}') #要回滚的前一个版本号
echo -e "\r\n"
echo 'Version number that you want to roll back'
echo -e "\r\n"
echo $rocback_version #版本号
echo -e "\r\n"
echo 'are you sure of to ' $rocback_version ' Yes or No' #确定要回滚过去
echo -e "\r\n"
read answer  #读取用户输入
if [ $answer == "Yes" ]
then
        svn up -r $rocback_version #回滚代码
        echo -e "\r\n"
        echo 'Code is rocback is OK !!!^__^!!!'

else
        echo "Abandoned operation program exit" #放弃操作
fi