I would like to have optional variables in my script, because I don't always need to use them.
For example in my script I have:
hiveParams=""
if [ "$1" == hiveParams=* ]; ### if the first param starts with hiveParams=
then
echo "$hiveParams"
spark submit --conf spark.sql.hive.conf.list=\$hiveParams
fi
And when I run the script I would like that the script takes "TestHiveParams" and replace it in $hiveParams
sh test.sh hiveParams="TestHiveParams"
How can I make this run?
Update: I have added:
set -o --
and run the job:
sh test.sh --hiveParams="someParams"
and I get that the numbers of parameters is 0.
How should I define it , so that it recognizes it?