shell实例:获取当前svn版本号

功能:获取列表中当前代码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

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值