📄 filecompare.sh
字号:
#!/bin/ksh## SAMPLE NAME: fileCompare## FUNCTIONS: This sample shell script checksout a file and compares it with# the previous copy in the same directory. The CMVC_RELEASE# environment variable must be set if the releaseName is not# specified on the command line.## USAGE: fileCompare fileName [releaseName] [relativePathName]## ENVIRONMENT# VARIABLE(S): CMVC_FAMILY [CMVC_RELEASE] [CMVC_BECOME]## ORIGINS: 27## 5765-039 (C) COPYRIGHT International Business Machines Corp. 1991,1993# 5765-207 (C) COPYRIGHT International Business Machines Corp. 1993# 5765-202 (C) COPYRIGHT International Business Machines Corp. 1993# 5622-063 (C) COPYRIGHT International Business Machines Corp. 1993# 5765-069 (C) COPYRIGHT International Business Machines Corp. 1991,1993# All Rights Reserved# Licensed Materials - Property of IBM## US Government Users Restricted Rights - Use, duplication or# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.### NOTICE TO USERS OF THE SOURCE CODE EXAMPLES## INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THE SOURCE CODE# EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS, "AS IS" WITHOUT# WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A# PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE# OF THE SOURCE CODE EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS,# IS WITH YOU. SHOULD ANY PART OF THE SOURCE CODE EXAMPLES PROVE# DEFECTIVE, YOU (AND NOT IBM OR AN AUTHORIZED RISC System/6000* WORKSTATION# DEALER) ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR# CORRECTION.## * RISC System/6000 is a trademark of International Business Machines# Corporation.## /usr/lpp/cmvc/samples/fileCompare#if [ $# -eq 0 ]then echo "\nusage: $0 fileName [releaseName] [relativePathName]\n" echo "This sample shell script gets a file, locks it and compares it" echo "with the previous copy in the same directory. The CMVC_RELEASE" echo "environment variable must be set if the releaseName is not" echo "specified on the command line.\n" exit 1fiif [ -z "$CMVC_FAMILY" ]then echo "The CMVC family must be set with the CMVC_FAMILY environment variable." exit 1fi#if [ -z "$2" ]then if [ -z "$CMVC_RELEASE" ] then echo "The Release must be set in environment or given on the command line." exit else release=$CMVC_RELEASE fielse release=$2fiif [ -z "$3" ]then # issue the File command without the relative flag File -checkout $1 -release $release # exit if bad rc if [ $? -ne 0 ] then exit 1 fielse # issue the File command with the relative flag File -checkout $1 -release $release -relative $3 # exit if bad rc if [ $? -ne 0 ] then exit 1 fifi# determine the basename of the filebname=$(basename $1)# determine the pathname of the filepname=$(dirname $1)if [[ "$pname" = "." ]]then if [ -z "$3" ] then echo "diff $1 .$1" diff $1 .$1 else echo "diff $3/$1 $3/.$1" diff $3/$1 $3/.$1 fielse if [ -z "$3" ] then echo "diff $1 $pname/.$bname" diff $1 $pname/.$bname else echo "diff $3/$1 $3/$pname/.$bname" diff $3/$1 $3/$pname/.$bname fifi
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -