I have below shell script code which is working fine.
#!/bin/sh
run() {
cd /tmp/in/current
java \
-Dlog4j.configurationFile=/tmp/in/logging/log4j2_Importer.xml \
-Djava.security.egd=file:///dev/urandom \
-classpath /tmp/in/runner/lib/*:/tmp/in/lib/* \
baag.runner.Application \
--config /tmp/in/config/import.dev.properties.TODO \
--workflow import \
--inputDir "$1"
}
dev_path="/data/etl-dev/in/eurex"
simu_path="/data/etl-simu/in/eurex"
mode=$1
case "$mode" in
"$dev_path" | "$simu_path" )
run "$mode"
;;
*) echo "error: invalid mode" >&2
exit 1
;;
esac
But currently i can run this code only on dev database as you can see in run function script the import.dev.properties.TODO is set as dev. I want to make this flexible such that if the path is "/tmp/in/simu" for simu_path variable then the properties should be import.simu.properties.TODO and for dev_path it should be import.dev.properties.TODO so that it will run on the respective database.
I am not sure if its possible to set parametarized variable here. For example something like this import.${varaible_here_dev_or_simu}.properties.TODO
I want to keep the dev_path and simu_path as it is as it can be changed as i am passing this in argument
runfunction a lot easier to read if you put each statement on a separate line.import.$(basename "$1").properties.TODO?\(I edited to do that)