Equivalent of .bat in mac os

前端 未结 3 1803
说谎
说谎 2020-12-24 05:46

I currently use a .bat file that is utilized to invoke a java file. If I wanted to utilize the same functionality on Mac OS what format changes would I make? (u

3条回答
  •  眼角桃花
    2020-12-24 06:14

    May be you can find answer here? Equivalent of double-clickable .sh and .bat on Mac?

    Usually you can create bash script for Mac OS, where you put similar commands as in batch file. For your case create bash file and put same command, but change back-slashes with regular ones.

    Your file will look something like:

    #! /bin/bash
    java -cp  ".;./supportlibraries/Framework_Core.jar;./supportlibraries/Framework_DataTable.jar;./supportlibraries/Framework_Reporting.jar;./supportlibraries/Framework_Utilities.jar;./supportlibraries/poi-3.8-20120326.jar;PATH_TO_YOUR_SELENIUM_SERVER_FOLDER/selenium-server-standalone-2.19.0.jar" allocator.testTrack
    

    Change folders in path above to relevant one.

    Then make this script executable: open terminal and navigate to folder with your script. Then change read-write-execute rights for this file running command:

    chmod 755 scriptname.sh
    

    Then you can run it like any other regular script: ./scriptname.sh

    or you can run it passing file to bash:

    bash scriptname.sh
    

提交回复
热议问题