#!/bin/bash
result=0
if [ $# -eq 2 ];then
java -jar test.jar $1 $2
result=$?
fi
if [ $# -eq 1 ];then
java -jar test.jar $1
result=$?
fi
if [ $# -eq 0 ];then
echo "exec default"
java -jar test.jar
result=$?
fi
echo "exit code is $result"
if [ $result -ne 0 ];then
exit 1
fi
【Linux】Shell执行Java jar传入参数并获取退出码
最新推荐文章于 2024-01-09 09:44:47 发布