I am attempting to write some configuration based on the version I am installing in a image. I am fetching the version as a build argument.
...
ARG XDEBUG_VERSION=3.1.2
RUN if [ "$XDEBUG_VERSION" = "3.1.2" ]; then echo "yes, it is 3.1.2"; fi
RUN if [ "$XDEBUG_VERSION" = "3*" ]; then echo "yes, starts with 3"; fi
...
Checking if the value is 3.1.2
works, but checking if it starts with 3
is not working. Below is the run outupt.
Step 20/22 : RUN if [ "$XDEBUG_VERSION" = "3.1.2" ]; then echo "yes, it is 3.1.2"; fi
---> Running in e1499d0ec491
yes, it is 3.1.2
Removing intermediate container e1499d0ec491
---> ad2439fcec2e
Step 21/22 : RUN if [ "$XDEBUG_VERSION" = "3*" ]; then echo "yes, starts with 3"; fi
---> Running in b8da583b4522
Removing intermediate container b8da583b4522
---> a9dbc5535002
So, How can I check if the build argument starts with certain characters?