How to convert a Windows batch file to a Linux shell script?

I have a batch file and it has below command (.bat file) to execute my application. I need to move the same application to Linux environment and write a .sh file to run the same application. I have no idea about using shell scripting. Can anyone give an idea to convert this to a .sh file?

SET currentDir=%CD%
CD %~dp0
SET CLASSPATH=./lib/*;
java -Dlogback.configurationFile=./com/logback.xml  -cp "%CLASSPATH%";"App.jar" com.test.main.MainClient
SET ERROR_LEVEL=%ERRORLEVEL%
CD %currentDir%
EXIT /B %ERROR_LEVEL%

      

+3


source to share


2 answers


Since it doesn't seem very complicated, the conversion shouldn't be too difficult. Take a look here for a comparison of package and bash syntax.



You can leave your java command almost as it is, just change the way you call it CLASSPATH

. And keep in mind that bash is case sensitive.

+1


source


Try this online conversion tool - https://www.onlinetoolsportal.com/online-batch-file-shell-script-converter/



0


source







All Articles