PDA

View Full Version : Launch multiple perl files from terminal?




Isoparm
May 6, 2011, 12:20 PM
I've got a number of perl programs I run fairly constantly. Right now I open up a tab in terminal and navigate to the directory and launch each one (one by one).

But ideally I'd love to setup up some sort of bash program or something that would launch the all the perl programs just by running that one bash program.

Is that possible? And is it possible to do that so it opens in tabs? (Or at the minimum new terminal windows?)

Thanks



nofunsir
May 7, 2011, 01:31 AM
1) Open terminal.

2) Paste this:

echo sometemporarytext > ~/Desktop/opensesame.command; chmod +x ~/Desktop/opensesame.command

3) Open opensesame.command (it should be on your desktop) in your favorite text editor (right click, open with...).

4) Replace "sometemporarytext" with:


echo perl /Path/to/A.pl > launchA.command; #make some temporary bash scripts to open your...
echo perl /Path/to/B.pl > launchB.command; #...perl scripts, one per perl script that you...
echo perl /Path/to/C.pl > launchC.command; #...want in a new window.

chmod +x launchA.command; #make sure each of these scripts are executable
chmod +x launchB.command;
chmod +x launchC.command;

open launchA.command; #open each script in a new terminal window
open launchB.command;
open launchC.command;

sleep 1; #wait 1 second before continuing (to avoid deleting the launchers before they have a chance to execute)

rm launchA.command; #delete launchers
rm launchB.command;
rm launchC.command;



5) Save and close your text editor.

6) You are now free to double-click opensesame.command