Launch multiple perl files from terminal?

Discussion in 'Mac OS X Server, Xserve, and Networking' started by Isoparm, May 6, 2011.

  1. Isoparm macrumors newbie

    Jul 15, 2005
    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?)

  2. nofunsir macrumors member


    Dec 30, 2009
    Ta daa

    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/ > launchA.command; #make some temporary bash scripts to open your... 
    echo perl /Path/to/ > launchB.command; #...perl scripts, one per perl script that you... 
    echo perl /Path/to/ > 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

Share This Page