Computer Science Canada

batch files for mac?

Author:  Insectoid [ Fri Nov 21, 2008 4:12 pm ]
Post subject:  batch files for mac?

Any mac users out there know how to write a script that will automatically run through the terminal on a mac? Similar to a batch file on Windows. I need it to execute when you click the icon, so no need to type into the terminal (working on a program in Perl, I want the script to navigate to the correct folder, then execute the perl script.

ex.
code:

cd desktop/TextGenerator
perl sentenceGeneratorV2.pl


I need that code to be executed in the terminal.

Author:  Tony [ Fri Nov 21, 2008 7:24 pm ]
Post subject:  RE:batch files for mac?

the term is bash scripting and it's the same as on any other *nix system running bash for it's shell.

Author:  md [ Fri Nov 21, 2008 7:30 pm ]
Post subject:  RE:batch files for mac?

Or even more correctly shell scripting since it's a script that runs in a shell Wink

something like
code:
#!/bin/bash
cd ~/desktop/TextGenerator
perl sentenceGeneratorV2.pl


should probably do it

Author:  Insectoid [ Sat Nov 22, 2008 7:19 am ]
Post subject:  RE:batch files for mac?

But what do I save it as? Text files, obviously, open in a text editor.

Author:  wtd [ Sun Nov 23, 2008 1:37 pm ]
Post subject:  RE:batch files for mac?

It doesn't really matter what extension you give it. This isn't Windows. But, if you want to do so, use the standard file extension for a Unix shell file.

I leave that to your research capabilities to find out.


: