[b]shell 中的数组[/b]
[b]变量赋值[/b]
输出:
#保险例子 ./grepLog.sh "ins" "grep Exception -A20 -B20 /home/q/www/ttsins.***.com/logs/vendor.log.2013-09-11-16" #搜索 ./grepLog.sh "tts_is" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-13.gz" #常规机器 ./grepLog.sh "ttsi" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #TTM ./grepLog.sh "ttm" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #JOB ./grepLog.sh "job" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #avfeedback ./grepLog.sh "avfeed" "zegrep ZLIB /server/tomcat/logs/tts.log.2013-09-26-11.gz" #router ./grepLog.sh "router" "grep Exception /home/q/www/router/logs/search.log" #task ./grepLog.sh "task" "grep Exception /server/tts/logs/tts.log.2013-09-26-11.gz" #work ./grepLog.sh "work" "grep Exception /home/q/www/ttssearch/logs/dubbo-access-2013-12-03.log"
输出:
#保险例子 ./grepLog.sh "ins" "grep Exception -A20 -B20 /home/q/www/ttsins.***.com/logs/vendor.log.2013-09-11-16" #搜索 ./grepLog.sh "tts_is" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-13.gz" #常规机器 ./grepLog.sh "ttsi" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #TTM ./grepLog.sh "ttm" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #JOB ./grepLog.sh "job" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #avfeedback ./grepLog.sh "avfeed" "zegrep ZLIB /server/tomcat/logs/tts.log.2013-09-26-11.gz" #router ./grepLog.sh "router" "grep Exception /home/q/www/router/logs/search.log" #task ./grepLog.sh "task" "grep Exception /server/tts/logs/tts.log.2013-09-26-11.gz" #work ./grepLog.sh "work" "grep Exception /home/q/www/ttssearch/logs/dubbo-access-2013-12-03.log"
tomcat_ow="name password job school"
tomcat_ow_array=($tomcat_ow)
${tomcat_ow_array[1]}
[b]变量赋值[/b]
var=`cat help.txt`
echo $var
输出:
#保险例子 ./grepLog.sh "ins" "grep Exception -A20 -B20 /home/q/www/ttsins.***.com/logs/vendor.log.2013-09-11-16" #搜索 ./grepLog.sh "tts_is" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-13.gz" #常规机器 ./grepLog.sh "ttsi" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #TTM ./grepLog.sh "ttm" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #JOB ./grepLog.sh "job" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #avfeedback ./grepLog.sh "avfeed" "zegrep ZLIB /server/tomcat/logs/tts.log.2013-09-26-11.gz" #router ./grepLog.sh "router" "grep Exception /home/q/www/router/logs/search.log" #task ./grepLog.sh "task" "grep Exception /server/tts/logs/tts.log.2013-09-26-11.gz" #work ./grepLog.sh "work" "grep Exception /home/q/www/ttssearch/logs/dubbo-access-2013-12-03.log"
var=$(cat help.txt)
echo $var
输出:
#保险例子 ./grepLog.sh "ins" "grep Exception -A20 -B20 /home/q/www/ttsins.***.com/logs/vendor.log.2013-09-11-16" #搜索 ./grepLog.sh "tts_is" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-13.gz" #常规机器 ./grepLog.sh "ttsi" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #TTM ./grepLog.sh "ttm" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #JOB ./grepLog.sh "job" "zegrep ZLIB /server/tts/logs/tts.log.2013-09-26-11.gz" #avfeedback ./grepLog.sh "avfeed" "zegrep ZLIB /server/tomcat/logs/tts.log.2013-09-26-11.gz" #router ./grepLog.sh "router" "grep Exception /home/q/www/router/logs/search.log" #task ./grepLog.sh "task" "grep Exception /server/tts/logs/tts.log.2013-09-26-11.gz" #work ./grepLog.sh "work" "grep Exception /home/q/www/ttssearch/logs/dubbo-access-2013-12-03.log"