I have a web application that is deploying to a server. I am trying to create a script that other things read the current version of a web application from a properties file that is deployed with the application.
The file is as follows:
//other content
version=[version number]
build=[buildnumber]
//other content
I want to create a variable that looks like this: version-buildnumber
Here is my script for it:
VERSION_FILE=myfile
VERSION_LINE="$(grep "version=" $VERSION_FILE)"
VERSION=${VERSION_LINE#$"version="}
BUILDNUMBER_LINE=$(grep "build=" $VERSION_FILE)
BUILDNUMBER=${BUILDNUMBER_LINE#$"build="}
THEVERSION=${VERSION}-${BUILDNUMBER}
The strange thing is that this works in some cases, but not in others. The problem I get is when I try to concatenate strings (i.e. the last line above). In some cases, it works fine, but in other characters from one line, characters from another are placed instead of characters.
In these cases, it does not work :
- When I read from the expanded file
:
. -, ?
/Ludwig