I routinely open a lot of Terminal windows each with an ssh session. To streamline the process I have a series of shell scripts that look like this:
tell application "Terminal"
do script "set_background_color salmon; ssh firstname.lastname@example.org"
When you double-click a .command file, the file is passed to Terminal and Terminal creates a window and executes the commands within it. The commands in your .command file use AppleScript to tell Terminal to run a command in yet another window.
Why not remove the middle man and just put the ultimate commands you want to run —
set_background_color salmon; ssh email@example.com — in the .command file? Drop that stuff with running an AppleScript. In other words, the contents of your .command file should just be:
set_background_color salmon ssh firstname.lastname@example.org
Alternatively, you could take the AppleScript from your .command file (the part between
EOS), put it into Script Editor.app, and save it as an applet.