Bash call exec with one additional prepended parameter

38 Views Asked by At

In some cases I need to pass in an additional prepended parameter to the command line args used when I call exec. How can I accomplish this?

if [ -z "$MILL_HOME" ] ; then
   exec $MILL_EXEC_PATH "$@"
else
   MILL_EXEC_ARGS=("--home" "$MILL_HOME" "$@") 
   exec $MILL_EXEC_PATH "$MILL_EXEC_ARGS"
fi

In the case above I am trying to make --home $MILL_HOME be the first argument passed in when $MILL_HOME is present.

0

There are 0 best solutions below