I have a .bat file that I need to convert into a Linux .sh one.
In this .bat script there si some piece of code I just do not understand and I cannot find proper keywords to search it's meaning.
Here is the code:
if not x%VERSION:SNAPSHOT=%==x%VERSION% (
echo " .... SNAPSHOT version detected "
echo VERSION=%VERSION:SNAPSHOT=%%formatdate%_%formattime%
)
My main problem lies with the usage of a ":". What does %VERSION:SNAPSHOT=% do?
I also do not know the meaning of the 'x' in x%VERSION%
or x%VERSION:SNAPSHOT%
.
set /?
- the colon is used to replace one substring with another after=
==
sign is a dirty hack: it prevents a syntax error in case either side of the==
sign evaluates to nothing.