- #!/bin/sh
- WORK_HOME=`pwd`
- filesPath=$WORK_HOME"/files"
- #判断files目录是否存在,如果不存在提示并退出程序
- if [ ! -d "$filesPath" ]; then
- echo "不存在目录:$filesPath";
- exit 0;
- else
- echo "成功找到目录:$filesPath";
- fi
- #判断files目录是否为空
- fileCount=`ls $filesPath | wc -l`
- echo "files目录内文件数量:$fileCount"
- if [ ! "$fileCount" -gt "0" ]; then
- echo "files目录是空的,没有要更新的内容,退出"
- exit 0;
- fi
- echo "==========================================="
- jarlist=`find *.jar`
- for jarName in $jarlist
- do
- echo "开始处理:" $jarName
- cp $jarName files
- cd files
- jar uvf $jarName *
- mv $jarName ../
- cd $WORK_HOME
- echo "==========================================="
- done
- #该片段来自于http://www.codesnippet.cn/detail/111120137036.html
来源: http://www.codesnippet.cn/detail/111120137036.html