I am automating some deployment task with an .sh script but at some point I need to rename a file but it is not working. The file change can be different but the postfix is the same. Let's have a look at this example so you will understand what is that I exactly need:
read folderName
#... at somepoint this scripts creates a file called foldername-1.0-SNAPSHOT.war (I need to rename it)
oldExecutableName ="" + $folderName + "-1.0-SNAPSHOT.war"
newExecutableName ="" + $folderName + ".war"
[[ -f "${newExecutableName}" ]] &&
mv -v ${oldExecutableName} ${newExecutableName}
Example:
Given input filename
Desired name for file is: filename.war
The text -1.0-SNAPSHOT should be removed from the name of the file
for some reason this is not working, and I think it is because the parameter I am reading from the terminal. Can someboby give me a hand to rename this?