I have the below code where my if condition is not working in a simple shell script.
#!/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/betl-runner/lib/*:/tmp/in/lib/* baag.betl.runner.Application --config /tmp/in/config/import.dev.properties.TODO --workflow import --inputDir "$1"
}
dev_path="/tmp/in"
mode=$1
if [ "$mode" = "$dev_path" ]; then
run "$mode"
fi
In the if condition if I just do if [ "$mode" = "" ]; then somehow the code runs, but I don't know why the above if condition is failing.
"$mode" = dev_pathshould be"$mode" = "$dev_path"in your if condition?