⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trackstats.sh

📁 CMVC是IBM和许多跨国公司的缺陷管理工具。这里给出了很多在Linux下用KSH编写的使用CMVC命令的例子。这些例子来自于IBM内部的CMVC培训。
💻 SH
字号:
#!/bin/ksh## SAMPLE NAME: trackStats## FUNCTIONS:   This sample shell script generates a track activity statistics#              report on a user area basis.## USAGE:       trackStats userArea## ENVIRONMENT# VARIABLE(S): CMVC_FAMILY [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/trackStats## *************************************************************************# Note: This file produces 132 column output and is easier to view and#       edit if displayed in 132 columns.# *************************************************************************#if [ $# -eq 0 ]then        echo "\nusage: $0 userArea\n"        echo "This sample shell script generates an activity statistics"        echo "report on a user area basis.\n"        exit 1fiif [ -z "$CMVC_FAMILY" ]then  echo "The CMVC family must be set with the CMVC_FAMILY environment variable."  exit 1fiDEPT=$1# Clean up on interrupttrap 'echo "\n$0: Interrupted."; cleanup; exit 1' 2 3 15cleanup(){        rm -f /tmp/tstat$$ 2>/dev/null}Report -vi TrackView -w "state not in ('complete') and userArea= '$DEPT'" \-raw | awk -F'|' '{print $1,$2,$4}' | sort >/tmp/tstat$$cat /tmp/tstat$$ | \awk '{    # When field one changes, output the "sum" line, unless this is the    # first record, since it is always different.    if ($1 != saveComp) {        if (NR == 1) {            printf "\n\n                TRACK ACTIVITY STATISTICS FOR DEPARTMENT '$DEPT'\n"            printf "\n%15.15s %8.8s %8.8s %9.9s %8.8s %8.8s %8.8s\n", "Release", "Approve", "Fix", "Integrate", "Commit", "Test", "Total"            printf "%15.15s %8.8s %8.8s %9.9s %8.8s %8.8s %8.8s\n", "---------------", "--------", "--------", "---------", "--------", "--------", "--------"            # initialize the totals            allApprv = 0            allFix = 0            allInt = 0            allCom = 0            allTest = 0        }        else {            allTotal += ttotal            printf "\n%15.15s %8.8s %8.8s %9.9s %8.8s %8.8s %8.8s\n", saveComp, apprv, fix, integrate, comm, ttest, ttotal        }        # Reset the save value and the "sum".        saveComp = $1        apprv    = 0        fix      = 0        integrate = 0        comm = 0        ttest = 0        ttotal = 0    }    # Accumulate the sum for every record.    ttotal += 1    if ($3 == "approve") {        apprv += 1        allApprv += 1    }    else if ($3 == "fix") {        fix += 1        allFix += 1    }    else if ($3 == "integrate") {        integrate += 1        allInt += 1    }    else if ($3 == "commit") {        comm += 1        allCom += 1    }    else if ($3 == "ttest") {        ttest += 1        allTest += 1    }}END {    # Output the last "sum" line after the last record was read.    printf "\n%15.15s %8.8s %8.8s %9.9s %8.8s %8.8s %8.8s\n", saveComp, apprv, fix, integrate, comm, ttest, ttotal    # Output the "all" totals    allTotal += ttotal    printf "\n%15.15s %8.8s %8.8s %9.9s %8.8s %8.8s %8.8s\n", "TOTAL", allApprv, allFix, allInt, allCom, allTest, allTotal}'[ -r /tmp/tstat$$ ] && rm -f /tmp/tstat$$

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -