0

定制自己的cvs命令

Posted in Linux at 十一月 10th, 2010 / No Comments »

经常在提交文件到cvs库时直接输入  cvs ci -m “some msg” 后不小心按下回车键,这种情况下CVS会自动对当前目录下的所有可提交的文件进行递归的提交,把一些不该提交或者注释不应该这样写的文件都提交到库中了。为了防止这种错误,自己写了一个shell脚本,阻止这种情况的提交。把/usr/bin/cvs重命名为cvsold,脚本命名为cvs放在/usr/bin下。脚本内容如下:

#!/bin/bash
if [ "$1" = "ci" -o "$1" = "commit" ]; then
    if [ -z "$3" ]; then
        echo "Please input Message!"
        exit 1
    fi
    if [ -z "$4" ]; then
        echo "Please input the file you want to commit"
        exit 2
    fi
    #echo "cvsold $*"
    cvsold ci -m "$3" $4
else
    commend="cvsold $@"
    #echo $commend
    $commend
fi
Published in Linux

No Responses to “定制自己的cvs命令”

Leave a Reply

请输入算式结果(看不清请点击图片)
(必须)