How to create batch files to run the scripts???

Hi again,

I’m planning to create batch files run the eggplant scripts through command lines. For this i want to know the way to create batch files on Mac OSX :?:
In windows, the procedure to create batch files is to write in all the commands in a text file and save it with the extn .bat
I actually tried to do the same on Mac, but this doesn’t work. :roll:
Help me for the same.
Thanks in advance.

Hi Payal–

The concept is the same, the execution is just a bit different.

You need to start your file with a thing called a shebang (?sp) and the name of the binary that you want to use. I assume you’re going to want to use bash (most macs run bash at the terminal):


Enter a blank line, and then enter the commands that you wish to execute, and then put a blank line at the end of the file.

Save it without an extension.

You then need to make the file executable (flip the executable bit). Go to the command line and type

chmod 777 

and then drag your batch file and drop it onto the terminal and hit enter. 777 is probably not the best set of permissions, but it will get the job done. if you get an error that says you don’t have permission to perform that action, hit the up arrow, left arrow back to the end of the line and add the word sudo to the command:

sudo chmod 777 <yourfile>

You will be prompted for your password, enter it, and then the command should complete.

Then, to run it go to terminal and type:


Again, you can drag the file onto terminal to avoid typing the path

Hope this helps.


PS If you want to see some help on the commands, just type

man <commandName>

in terminal to get the “man(ual) pages” for a given command

Keep in mind that an Eggplant script can also run other scripts, so a different approach that you may find simpler would be to write a batch or master script that looks something like this:

runWithNewResults script1
runWithNewResults script2, param1, param2
runWithNewResults script3, param3
-- ... run as many scripts as you like 

Then just use runscript to execute the master script from the command line.

This approach offers several advantages. The runWithNewResults command will make each script produce its own results log, just like it will if you run them separately from a shell script, but you also have access to those results from within the master script, which allows you to run cleanup scripts if necessary (if script1 fails, for example, and thereby leaves the SUT in a bad state for running script2). See the runWithNewResults documentation for more information.

Your master script could also do other things, such as connecting to different SUTs between script runs, posting the status of each script run to a web page, sending emails, and so forth. And you don’t have to learn anything about writing Unix shell scripts.

Of course, if you are already familiar with shell scripts, you may prefer to do it that way, but a SenseTalk script can do anything a shell script can, and usually much more easily. :slight_smile: