How to Open Multiple Customized Terminal Shells

terminal

How can I customized Terminal so that when I open the application it opens several shell tabs?
If possible I would like to also have it run a different environment script for each tab.

Example: Run this command source bin/activate which is a Python virtualenv setup command.

Best Answer

Add this to your ~/.bash_profile if you use bash or ~/.zshrc if you use zsh, changing the content of the COMMANDS array:

function openterms() {
    COMMANDS=("source bin/activate" "add another here" "continue likewise")
    for command in $COMMANDS
        do osascript -e \
        "tell application \"Terminal\" to do script with command \"$command\""
    done
}

Now calling openterms in a shell will open all the other shells you wanted.