用户登录
用户注册

分享至

shell更新jar包内容

  • 作者: 呵呵哈哈哈还好还好哈哈哈哈
  • 来源: 51数据库
  • 2022-09-22
#!/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
软件
前端设计
程序设计
Java相关