Hi all, hoping someone has some experience scripting screen, the best 
powertool ever.  :)

I have a little csh script I use to apply long running processes to 
various boxen - condensed for illustration:

runit.sh:
#!/bin/csh

foreach lin (lin1 lin2 linfoo linbaz)
   ssh $lin "$1"
end

Then I can run this to kick off a long running process on all 4:

./runit.sh "screen -d -m /some/long/script.sh"

Then I can log into each box and type screen -dr to see the progress, 
ctrl-a d to detach then logoff.

A couple problems I'm having.  #1 - I can't seem to parametrize 
script.sh - I'd like to be able to do this:

./runit.sh "screen -d -m /some/long/script.sh foo bar"

But that seems to exit immediately each time.  I tried to do it locally 
without the ssh stuff to see if maybe quoting would help, but even if I 
log into a box directly and do this it fails:

screen -d -m '/some/long/script.sh foo bar'

#2 I'd also like to take the output this script generates and tee it 
into a log file - something like:

screen -d -m '/som/long/script.sh | tee /var/log/myscript.log'

Interestingly this will create the log file, run the script, but not 
redirect the ouptut.

Anyway, if anyone has any non-religious thoughts on either or both of 
these I'd appreciate it whilst I dig through screen docs.

screen is 4.00.03

Random screen nugget:

screen
ctrl-a S
ctrl-a Tab
ctrl-a c

You now have a terminal window split into two sessions that you can use 
ctrl-a Tab to switch between - handy for tailing a log in one and 
working in the other.  In ubuntu I think you can do ctrl-a | instead of 
S to get a vertical split...

Thx,

Josh