screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems scripting screen


From: Micah Cowan
Subject: Re: Problems scripting screen
Date: Fri, 26 Jun 2009 15:35:31 -0700
User-agent: Thunderbird 2.0.0.21 (X11/20090409)

Nelgin wrote:
> Now, say I want to stuff a command..
> 
> screen -S machine1 -X stuff "who^J"
> 
> This works. However if I put it in for a for look
> 
> for i in `cat serverlist`
> do
> screen -S $i -X stuff "who^J"
> done

The most obvious explanation is that your for-loop isn't doing what you
think it's doing. Screen of course can't possibly know whether or not
it's being invoked as part of a for-loop, or a direct command: given the
same command arguments and the same environment (and sessions state), it
will behave the same way every time.

Knowing this, you should investigate how your for loop is behaving with
respect to how you expect it to behave. Perhaps the very act of running
from a script versus typing directly on a console introduces an
environmental change (fairly unlikely, but worth confriming). Perhaps
the values in "serverlist" aren't what you expect them to be, or the
file's not in the current working directory. Try placing an "echo" line,
or invoke the script using sh's -x option for explanations of how the
shell is evaluating your code.

-- 
HTH,
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer.
Maintainer of GNU Wget and GNU Teseq
http://micah.cowan.name/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]