Usage
fi
bkextn=sget_bak
hme=` echo $HOME | cut -f1 -d' ' `
if [ "$hme" = "" ]; then
print "\nError: \$HOME is not set!!\n"
exit
fi
# Check if file already exists....
if [ -f $1 ]; then
user_perms=" "
group_perms=" "
other_perms=" "
user_perms=`ls -l $1 | awk '{print $1 }' | cut -b3-3 `
group_perms=`ls -l $1 | awk '{print $1 }' | cut -b6-6 `
other_perms=`ls -l $1 | awk '{print $1 }' | cut -b9-9 `
if [ "$user_perms" = "w" -o "$group_perms" = "w" \
-o "$other_perms" = "w" ]; then
print "\nError: The file is writable. Aborting $cmdname ......"
print " You should either backup, scommit or delete the f
ile and"
print " try $cmdname again\n"
exit
fi
fi
cur_dir=`pwd`
#echo $cur_dir
len=${#hme}
len=$(($len + 2))
#echo $len
subdir=` echo $cur_dir | cut -b $len-2000 `
#echo $subdir
if [ "$subdir" = "" ]; then
fdname=$1
else
fdname=$subdir"/"$1
fi
# Move the file
touch $1 2>/dev/null
\mv -f $1 $1.$bkextn
# Create subshell
(
cd $hme
#echo $fdname
# Use -A option to clear all sticky flags
if [ "$FLAG1" = "" ]; then
cvs -r checkout -A $fdname
else
cvs -r checkout -A -$FLAG1 $OARG1 $fdname
fi
)
#pwd
if [ -f $1 ]; then
print "\nREAD-ONLY copy of the file $fdname obtained."
print "Done $cmdname"
#print "\nTip (Usage): $cmdname \n"
fi

投稿指南


