简体   繁体   English

如何将windows批处理文件转换为linux shell脚本?

[英]How convert windows batch file to linux shell script?

I have a batch file and it has below command(.bat file) to execute my application. 我有一个批处理文件,它有以下命令(.bat文件)来执行我的应用程序。 I need to move the same application to Linux environment and need to write .sh file to execute the same application. 我需要将相同的应用程序移动到Linux环境,并且需要编写.sh文件来执行相同的应用程序。 I don't have any idea of the shell scripting. 我对shell脚本没有任何想法。 Please can some one give idea to convert this to .sh file? 请问有人可以将此转换为.sh文件吗?

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%

Since it dosn't appear to be very complex, conversion shouldn't be too dificult. 由于它似乎不是很复杂,转换不应该太困难。 Have look here for a comparison of batch and bash syntax. 在这里查看批处理和bash语法的比较。

You can leave your java-command almost as it is, just change the way you call CLASSPATH . 你几乎可以保留你的java命令,只需改变你调用CLASSPATH的方式。 And keep in mind that bash is case-sensitive. 请记住,bash区分大小写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM