当前位置: 技术问答>linux和unix
shell的怪问题
来源: 互联网 发布时间:2016-09-12
本文导语: 这个是配置文件 # ********************************************************************** # # File : config.ini # # ********************************************************************** ### Path ### Tomcat Name: apache-tomcat-6.0.28.tar.gz T...
这个是配置文件
# **********************************************************************
#
# File : config.ini
#
# **********************************************************************
### Path ###
Tomcat Name: apache-tomcat-6.0.28.tar.gz
Tomcat Path: .
Axis2 Name: axis2-1.5.1-war.zip
ARR Name: aaa.aar
Pattern File Name: bbb.resp
Pattern File Path: webapps/axis2/WEB-INF/files
### HotKey Command ###
### This line is the HotKeyCommand begin signal, please don't modify it ###
startup:
shutdown:
restart:
reload: curl
### This line is the HotKeyCommand end signal, please don't modify it ###
### Options ###
# **********************************************************************
#!/bin/sh
readConfig()
{
signal="Path"
while read line
do
if [ "$line" = "### This line is the HotKeyCommand begin signal, please don't modify it ###" ]; then
signal="HotKeys"
fi
if [ "$signal" != "Path" ]; then
echo $line
str=`echo $line | grep -v '^[s]*$' | awk '/^[^#]/{print $0}'`
if [ "X$str" != "X" ];
then
name=`echo $str | awk -F: '{ print $1 }'`
value=`echo $str | awk -F: '{ print $2 }'`
echo $value
case "name" in
"Tomcat Name")
tomcatName=$value
echo $tomcatName"="$value
;;
"Tomcat Path")
tomcatPath=$value
;;
"Axis2 Name")
axis2Name=$value
;;
"ARR Name")
aRRName=$value
;;
"Pattern File Name")
patternFileName=$value
;;
"Pattern File Path")
patternFilePath=$value;;
esac
fi
fi
done