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 "\nUsage: $cmdname \n"
exit
fi
# Check if file does not exist....
if [ ! -f $1 ]; then
print "\nError: $1 is NOT a file. Aborting $cmdname ......"
exit
fi
cvs log $1 | /usr/local/bin/less
print "\nDone $cmdname. $cmdname successful"
#print "\nTip (Usage): $cmdname \n"
_________________________________________________________________
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 "\nUsage: $cmdname "
print "$cmdname -r -r \n"
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 "\nUsage: $cmdname \n"
exit
fi
# Check if file exists ....
if [ -f $1 ]; then
cvs add $1
exit
fi
if [ ! -d $1 ]; then
print "\nArgument $1 is not a file and not a directory!"
print "Usage: $cmdname \n"
exit
fi
# Argument is a directory name .....
hme=` echo $HOME | cut -f1 -d' ' `
if [ "$hme" = "" ]; then
print "\nError: \$HOME is not set!!\n"
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 "\nDirectory $1 already exists in CVSROOT"
exit
else
# You are adding at root directory $CVSROOT
if [ "$2" = "" -o "$3" = "" ]; then
print "\nUsage: $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 "\nDirectory $1 already in CVS repository!"
else
cvs add $1
fi
else
print "\nSub-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 "\nUsage: $cmdname \n"
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 "\nError: $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 "\nsdelete 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 "\nDone $cmdname. $cmdname successful"
#print "\nTip (Usage): $cmdname \n"
\mv -f $1.$bkextn $1
文章来源于领测软件测试网 https://www.ltesting.net/
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备10010545号-5
技术支持和业务联系:info@testage.com.cn 电话:010-51297073