CVS-RCS(7)(转)

CVS-RCS(7)(转)[@more@]

4.8 slog

注意 : Korn shell /bin/ksh 在你从Linux CD-ROM 安装 pdksh*.rpm 时就会产

请把他存成一般文字档并改变存取权限 chmod a+rx

_________________________________________________________________

#!/bin/ksh

# CVS program slog

# Program to list history of the file in CVS

cmdname=`basename $0`

if [ $# -lt 1 ]; then

print " Usage: $cmdname "

exit

fi

# Check if file does not exist....

if [ ! -f $1 ]; then

print " Error: $1 is NOT a file. Aborting $cmdname ......"

exit

fi

cvs log $1 | /usr/local/bin/less

print " Done $cmdname. $cmdname successful"

#print " Tip (Usage): $cmdname "

_________________________________________________________________

4.9 sdif

注意 : Korn shell /bin/ksh 在你从Linux CD-ROM 安装 pdksh*.rpm 时就会产

请把他存成一般文字档并改变存取权限 chmod a+rx

_________________________________________________________________

#!/bin/ksh

# CVS program sdif

# Program to see difference of the working file with CVS copy

cmdname=`basename $0`

Usage()

{

print " Usage: $cmdname "

print "$cmdname -r -r "

exit

}

FLAG1=""

FLAG2=""

OARG1=""

OARG2=""

# Command getopt will not supported in next major release.

# Use getopts instead.

while getopts r:r: ii

do

case $ii in

r)

if [ "$FLAG1" = "" ]; then

FLAG1=$ii;

OARG1="$OPTARG"

else

FLAG2=$ii;

OARG2="$OPTARG"

fi

;;

?) Usage; exit 2;;

esac

done

shift ` expr $OPTIND - 1 `

if [ "$FLAG2" = "" ]; then

FLAG2=r

OARG2=HEAD

fi

if [ "$FLAG1" = "" ]; then

cvs diff -r HEAD $1 | less

else

cvs diff -$FLAG1 $OARG1 -$FLAG2 $OARG2 $1 | less

fi

_________________________________________________________________

4.10 sadd

注意 : Korn shell /bin/ksh 在你从Linux CD-ROM 安装 pdksh*.rpm 时就会产

请把他存成一般文字档并改变存取权限 chmod a+rx

_________________________________________________________________

#!/bin/ksh

# test

# CVS program sadd

# Program to add the file to CVS

cmdname=`basename $0`

if [ $# -lt 1 ]; then

print " Usage: $cmdname "

exit

fi

# Check if file exists ....

if [ -f $1 ]; then

cvs add $1

exit

fi

if [ ! -d $1 ]; then

print " Argument $1 is not a file and not a directory!"

print "Usage: $cmdname "

exit

fi

# Argument is a directory name .....

hme=` echo $HOME | cut -f1 -d `

if [ "$hme" = "" ]; then

print " Error: $HOME is not set!! "

exit

fi

cur_dir=`pwd`

len=${#hme}

len=$(($len + 2))

subdir=` echo $cur_dir | cut -b $len-2000 `

if [ "$subdir" = "" ]; then

if [ -d $CVSROOT/$1 ]; then

print " Directory $1 already exists in CVSROOT"

exit

else

# You are adding at root directory $CVSROOT

if [ "$2" = "" -o "$3" = "" ]; then

print " Usage: $cmdname

ase tag>"

print "For example - "

print " $cmdname foo_directory V_1_0 R_1_0"

exit

else

(

cd $1;

cvs import $1 $2 $3

)

fi

fi

else

# If current directory exists in CVS...

if [ -d $CVSROOT/$subdir ]; then

if [ -d $CVSROOT/$subdir/$1 ]; then

print " Directory $1 already in CVS repository!"

else

cvs add $1

fi

else

print " Sub-directory $subdir does not exist in CVS"

print "You need to first add $subdir to CVS"

exit

fi

fi

_________________________________________________________________

4.11 sdelete

注意 : Korn shell /bin/ksh 在你从Linux CD-ROM 安装 pdksh*.rpm 时就会产

请把他存成一般文字档并改变存取权限 chmod a+rx

_________________________________________________________________

#!/bin/ksh

# CVS program sdelete

# Program to delete the file from CVS

cmdname=`basename $0`

if [ $# -lt 1 ]; then

print " Usage: $cmdname "

exit

fi

# Check if file does not exist....

if [ ! -f $1 ]; then

# Try to get the file from CVS

sget $1

if [ ! -f $1 ]; then

print " Error: $1 does NOT exist in CVS repository. Aborting $

cmdname ......"

exit

fi

fi

bkextn=cvs_sdelete_safety_backup

mv -f $1 $1.$bkextn

cvs remove $1

print " sdelete command removes the file from CVS repository"

print "and archives the file in CVS Attic directory. In case"

print "you need this file in future than contact your CVS administrator"

print " "

print " Done $cmdname. $cmdname successful"

#print " Tip (Usage): $cmdname "

mv -f $1.$bkextn $1

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8225414/viewspace-945081/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8225414/viewspace-945081/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值