📄 getreport.sh
字号:
#!/usr/bin/ksh#To get ISN report file from RM#Author: RuanWX#Usage: `basename $0` -c origin_command_line -v version i report_id#in which attributes_string is like: userLabel:neType:availableCapNum#Please note if an attribute includes metacharacters, the metacharacters must be escaped#Example: $FDN must be \$FDN#Or the whole attributes_string is quoted by ', such as '$FDN:userlabel'.USAGE="`basename $0` -c origin_command_line -v version -i report_id";if [ $# -ne 6 ]; then echo "$USAGE"; exit 1;fiwhile getopts c:v:i:o OPTION ; do case "$OPTION" in c) COMMAND="$OPTARG" ;; v) VERSION="$OPTARG" ;; i) REPORT_ID="$OPTARG" ;; \?) echo "$USAGE" ; exit 1 ;; esacdoneecho "COMMAND: $COMMAND VERSION: $VERSION REPORT_ID: $REPORT_ID";if [ -z "$COMMAND" ] ; then echo "ERROR : command is not specified."; exit 1;fiif [ -z "$VERSION" ] ; then echo "ERROR : version is not specified."; exit 1;fiif [ -z "$REPORT_ID" ]; then echo "ERROR: report_id is not specified."; exit 1;fiCONFIG_FILE_NAME="Rep_$VERSION.cfg";#Attr_Names--attribute names;#Attr_Types--attribute types;#Obj_Deleted--0:object is not deleted;1:object is deletedparseConf(){ Obj_Deleted=`awk -F":" '{ deleted=0; if ( $0 ~ /^ *\t* *#.*/ ){ } else if ( $0 ~ /^ *\t* *$/ ){ } else if ( $1 ~ /[0-9]*/ ) { if ($1==id ){ if (length($3)==0 ){ deleted=1; } printf deleted; } } }' id=$REPORT_ID $CONFIG_FILE_NAME`; if [ $Obj_Deleted -eq 0 ]; then { Attr_Names=`awk -F":" '{ if ( $0 ~ /^ *\t* *#.*/ ){ } else if ( $0 ~ /^ *\t* *$/ ){ } else if ( $1 ~ /[0-9]*/ ) { if ($1==id ){ printf "%s\n",$3; } } }' id=$REPORT_ID $CONFIG_FILE_NAME`; Attr_Types=`awk -F":" '{ if ( $0 ~ /^ *\t* *#.*/ ){ } else if ( $0 ~ /^ *\t* *$/ ){ } else if ( $1 ~ /[0-9]*/ ) { if ($1==id ){ if (length($3)==0){ } else if (length($4)==0){ printf "%s:INT\n", $3; } else { printf "%s:%s\n",$3,$4; } } } }' id=$REPORT_ID $CONFIG_FILE_NAME`; } fi}parseConf;if [ -z "$Attr_Names" ]; then echo "No attribute is deleted."; $COMMAND;else echo "Delete attributes: $Attr_Names"; $COMMAND $Attr_Names;fi;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -