代码如下
shift是把传入的参数左移一个,第一个参数就没了
#! /bin/bash
first=2024-04-10
class=com.pack.ServiceStart
jarname=work-1.0.0.jar
if expr "$1" : 'com\.pack\..*art$' &>/dev/null
then
class=$1
shift
fi
if expr "$1" : '.*\.jar$' &>/dev/null
then
jarname=$1
shift
fi
first=$1
two=$2
three=$3
if [ -z "$first" ]; then
first=2024-04-10
fi
echo "$class"
echo "$jarname"
echo "$first"
echo "$two"
echo "$three"
params="$first $two $three"
spark-submit --master yarn --driver-class-path $HBASE_HOME/lib/*:lib/*:$HBASE_HOME/*.jar:$HBASE_HOME/conf --conf spark.executor.extraClassPath=$HBASE_HOME/lib/*:$HBASE_HOME/*.jar --name "测试名字" --class $class $jarname $params