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

📄 com.sh

📁 一个awk和bsh混合编程的例子
💻 SH
字号:
VERSION=51CREPORT_ID=21CONFIG_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":" '			BEGIN {deleted=0;}		/^ *\t* *#.*/ {;}		/^ *\t* *$/ {;}		/^[0-9]*/ {			if ($1==id ){				if (length($3)==0 ){					deleted=1;				}			}		}		END {printf "%d\n",deleted;}' id=$REPORT_ID $CONFIG_FILE_NAME`;		if [ $Obj_Deleted -eq 0 ]; then	{		Attr_Names=`awk -F":" '		BEGIN{attr_ix=0; printf "{"}		/^ *\t* *#.*/ {;}		/^ *\t* *$/ {;}		/^[0-9]*/ {			if ($1==id ){				if (attr_ix==0){					printf "%s",$3;				}				else{					printf ":%s",$3;				}				attr_ix+=1;			}		}		END {printf "}\n";}' id=$REPORT_ID $CONFIG_FILE_NAME`;	}	fi}aaa="aaaaaaa";bbb="bbbbbbbb";ccc="cccccccc";ddd=$aaa":"$bbb":"$ccc;echo $ddd;parseConf;echo $Attr_Namesif [ "$Attr_Names"="{}" ];then	echo "empty";fi

⌨️ 快捷键说明

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