功能:获取列表中当前代码svn版本号
tar.list文件中内容:
[xiaoz@H144134:/bauser/xiaoz$]cat tar.list
bafe/tmpsql/srcb00227881_srcb00232812.sql(文件不存在svn版本库)
bafe/src/ibs/busi/ibsnb3277.pc
bafe/etc/bafesoap/ibs/openMainSubAcct.xml
实际效果:
[xiaoz@H144134:/bauser/xiaoz$]sh show.sh tar.list
tar.list
svn: 'bafe/tmpsql' is not a working copy
r59523
r59522
代码:
#!/usr/bin/ksh
#function:show filelist version
#autuer:cx
#contact:qq316850652@163.com
#date:20181119
#useage:please input a parameter,like"*.list" and this script will show the current version.example:sh show tar.list
FILENAME=$1
if [ $# -ne 1 ]
then
echo "error usage,please choice new selection"
select choice in "exit" "renew input"
do
case $choice in
"exit")
return -1;;
"renew input")
read a
FILENAME=$a
break;;
esac
done
fi
echo $FILENAME
while [ ! -f ./$FILENAME ]
do
echo "please input filename again"
read b
FILENAME=$b
done
c="`awk '/^bafe/{print $0}' $FILENAME`"
if [ ! -n $c ]
then
echo error cause following reason:
echo this file is empty
echo the file content is not head with "bafe"
return -1;
fi
cat $FILENAME|while read line
do
svn log $line|sed -n '2p'|awk '{print $1}'
done