screen-users
[Top][All Lists]
Advanced

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

Execute script in specific window


From: Peter Rait
Subject: Execute script in specific window
Date: Mon, 21 Jan 2008 15:01:55 +0100
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Hi,

I am new to this list and I would ask you if you can help me for a problem I did not find an answer in the list archive: I am using screen version 4.00.02 on a SLES10 machine. I have created a screen session with a number of windows named individually with numbers from 1101 to 1200. Now I would like to run a script where I can specify a range of windows where I want to start a script having the window title as parameter. For one specific window I already achieved that:

a) screen -p 1101 -X eval 'stuff ./run_node.sh" 1101 \015"'

This switches to window 1101 and executes the command './run_node.sh 1101', which works pretty well. I thought that

b) screen -p 1101 -X exec ./run_node.sh 1101

will also do it but for some reason it never goes to window 1101 but executes the script in the current active window. So I decided to continue with approach a) which I have found in the mailing list archive. As next step I wanted to built my script for executing the same command line in several windows having the window name as parameter for the command line. My script will be executed like this:

./start_my_scripts <beginning of range> <end of range>

let zahl=$1;
let max=$(($2+1))
while [ $zahl -lt $max ];
do
 screen -p $zahl -X eval 'stuff ./run_node.sh" $zahl \015"'
 zahl=$((zahl+1));
done

When looking into the screen window it seems that now only the first part './run_node.sh' is executed without passing the parameter. This is not what I wanted. My questions would be: - Why the variable $zahl is resolved correctly at the left end of the screen command but not at the right end (seems to be empty)? - If the variable on the right side is empty because it is not known to the screen window how I can get it there?
- Why the approach b) did not work?
- If nothing helps is it possible to retrieve the window title in the script executed in the window? As it is the same as the method parameter this would be sufficient to get it running.

Thank you in advance for you help
Peter




reply via email to

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