Here's a quick and dirty command-line that achieves what you want:
$ tmux new-session -s asdf -n myWindow -d 'tail -f foo'\; \
split-window -d 'tail -f bar'\; attach-session
There are a few drawbacks to this solution:
it doesn't scale very well (a few more commands and the result is incomprehensible).
the two tail commands aren't run in an interactive shell, so if you exit them both, the window myWindow
will be destroyed (together with the session if you haven't created any more sessions.
Here's a shell script that works along the lines that you tried. For me it's always easiest to think about how I would achieve my goal manually and then translate that into tmux commands. This might not be the simplest or cleanest way, but it usually works:
#!/bin/sh
# create a new session. Note the -d flag, we do not want to attach just yet!
tmux new-session -s asdf -n 'myWindow' -d
# send 'tail -f foo<enter>' to the first pane.
# I address the first pane using the -t flag. This is not necessary,
# I'm doing it so explicitly to show you how to do it.
# for the <enter> key, we can use either C-m (linefeed) or C-j (newline)
tmux send-keys -t asdf:myWindow.0 'tail -f foo' C-j
# split the window *vertically*
tmux split-window -v
# we now have two panes in myWindow: pane 0 is above pane 1
# again, specifying pane 1 with '-t 1' is optional
tmux send-keys -t 1 'tail -f bar' C-j
# uncomment the following command if you want to attach
# explicitly to the window we just created
#tmux select-window -t asdf:mywindow
# finally attach to the session
tmux attach -t asdf
If after some trying you still don't like the tmux
command and configuration syntax, you might want to look into tmuxinator, a Ruby gem that lets you manage tmux sessions with a simplified and more transparent syntax.
In my answer to Multiple terminals at once without an X server you can find a few links to helpful tmux
resources