Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 batch files for mac?
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Insectoid




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
md




PostPosted: 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
Insectoid




PostPosted: 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.
wtd




PostPosted: 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.
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: