📄 showallcommonfiles.sh
字号:
#!/bin/ksh## SAMPLE NAME: showAllCommonFiles## FUNCTIONS: This sample shell script shows the files that are # common to other releases; that is, it shows all the# files that are not unique to this release.## This script does NOT show the releases to which the# common files are linked to. You can use the sample# showCommonFiles to show the releases to which a # common file is linked to.## USAGE: showAllCommonFiles releaseName## ENVIRONMENT# VARIABLE(S): CMVC_FAMILY [CMVC_BECOME]## 5765-207 (C) COPYRIGHT International Business Machines Corp. 1993,1995# 5765-202 (C) COPYRIGHT International Business Machines Corp. 1993,1995# 5622-063 (C) COPYRIGHT International Business Machines Corp. 1993,1995# 5765-397 (C) COPYRIGHT International Business Machines Corp. 1994,1995## 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/showAllCommonFiles##-----------------------------------------------+# Cleanup on exit or interrupt. |#-----------------------------------------------+terminate(){ cleanup exit 1}cleanup(){ rm -f $COMMON 2>/dev/null}yesno(){ read REPLY case "$REPLY" in n|no|N|NO) YESNO=no ;; *) YESNO=yes ;; esac}#-----------------------------------------------+# Begin program. |# Check for proper args or give usage. |#-----------------------------------------------+if [ $# -ne 1 ]then echo "\nusage: $0 releaseName\n" echo "This sample shell shows the files that are common"; echo "to other releases." echo "That is, it shows all the files that are not unique to this release." echo "" exit 1fiif [ -z "$CMVC_FAMILY" ]then echo "The CMVC family must be set with the CMVC_FAMILY environment variable." exit 1firelease=$1#-----------------------------------------------+# Setup the environment. |#-----------------------------------------------+trap 'echo "\n$0: Interrupted."; cleanup; exit 1' 2 3 15COMMON=/tmp/fpc$$#-----------------------------------------------------------------+# Obtaining the files that are not common to other releases. |#-----------------------------------------------------------------+Report -view FileView -raw -where " \ releaseName='$release' and \ nuDropDate is null and \ exists (select id from Files \ where sourceId=FileView.sourceId and \ nuDropDate is null and \ nuVersionId=FileView.nuVersionId and \ id <> FileView.id)" > $COMMONif [ -s $COMMON ]then awk -F"|" 'BEGIN { printf "\n%s\n", "These are the files that are not unique in release\n'$release'" printf "\n%-9.9s %-45.45s\n","Version","Path" printf "%-9.9s %-45.45s\n\n", "---------",\ "---------------------------------------------" } { if (length($8) > 45) start = (length($8)-44) else start = 0; printf "%-9.9s %45.45s\n",$4,substr($8,start) }' $COMMONelse echo "\nAll the files are not common to other releases." echo "\nThat is, they all are unique files in release $release"ficleanupexit 0# end of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -