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