Linux shell脚本编程 流程控制: 循环语句:for,while,until while循环: while CONDITION; do 循环体 done 进入条件:当CONDITION为“真”: 退出条件:当CONDITION为“假”: while CONDITION; do 循环体 控制变量的修正表达式 done 示例:求100以内所有正整数之和; #!/bin/bash # declare -i sum=0 declare -i i=1 while [ $i -le 100 ]; d
脚本如下: #!/bin/bash mysql -s -phello test >.log <<EOF desc t1; EOF lines="concat_ws(','," count=`.log|wc -l` linenum= while read line do coloumname=`echo $line |awk '{print $1}'` let linenum=linenum+ ];then lines=$lines"concat_ws(':'
java classpath批量设置shell脚本 注意:linux bash jar文件之间的分隔符是':' export JAR_HOME=path to directory which includes jars for f in $JAR_HOME/*.jar do JAR_CLASSPATH=$JAR_CLASSPATH:$f done export JAR_CLASSPATH #the next line will print the JAR_CLASS