#/bin/bash set -x #提交变更rpm到svn function commit_to_svn() { target_svn_dir=$1 #新增rpm至svn命令 add_to_svn="svn st | grep ? | grep rpm | cut -c 9-" #删除rpm至svn命令 del_to_svn="svn st | grep ! | grep rpm | cut -c 9-" subsvn_dir="rpm_x86_64_v2.1.repo rpm_x86_64_v2.1_security.repo rpm_i386_v2.1.repo rpm_i386_v2.1_security.repo" for var in $subsvn_dir do echo "**** $var *****" cd $target_svn_dir/$var/v2.1/ eval $add_to_svn echo "**** $?" :<<Comment svn add `svn st | grep ? | grep rpm | cut -c 9-` svn delete `svn st | grep ! | grep rpm | cut -c 9-` svn commit -m "submit `date`" Comment done } commit_to_svn $1