Interaction between profiles of Terminal.app and environment variables I wonder if and how it is possible to set shell environment variables based on the Terminal.app profile.

More specifically, I would like to use a coloured prompt in Terminal.app or iTerm2.app in Mac OS, but I would like to set the prompt colours (with PS1 variable) based on the selected profile of Terminal.app.  Is it possible to define environment variables as a part of the profile in Terminal.app?  Are there any workarounds for Terminal.app or for other terminal applications (for any operating systems) to define the prompt format and colors based on the selected "profile"?
You can run shell command on profile launch. You can find it in:

Preferences -&gt; Profile -&gt; Selected Profile -&gt; Shell -&gt; Run command.

You can have separate files with PS1 variable and source them using this "Run command" option.