I'm new to scripting so please bear with me (if you can).
I want to do something similar to this question but the 'root' directory will be different for different users on different OS (there can't be any windows paths 'hardcoded' else the script will fail on another machine).
I'm running cygwin on Windows 7 and the script I want will also be accessed by users running Linux.
I can simply do this on my machine:
cd "D:/first/second/third/fourth/fifth" (contains pom.xml I want to execute)
mvn clean package
The location "D:/first/second/third/" is the basedir on my machine, so can I find a relative path for this that will work on windows and linux?
The pom.xml I want to execute lives under /fourth/fifth/.
I've used find -name pom.xml -type f
but this returns many different pom.xml files in all subdirectories under my current one:
D:/first/second/third/pom.xml
D:/first/second/third/fourth/pom.xml
D:/first/second/third/fourth/fifth/pom.xml -> I want to run this one only
D:/first/different-secondsecond/pom.xml
Can anyone give me some tips how I can make a OS independent script that will find and run the pom that I want?
Thanks in advance