How do you override a variable in your Bash script from the command line?
I know how to pass variables in, but I just want something like ./myscript.sh -Dvar=v
./myscript.sh -Dvar=v
You should specify the variable with the following syntax:
MYVAR=74 ./myscript.sh
Within the script, check if it is already set before setting it:
if [ ! -z $MYVAR ]; then #do something fi