Hi, Stefan Kuhlemann wrote:
I'm looking for a solution for a problem which keeps nagging me for quite some time...
This might help. [The script screen-test.sh runs the secondary script] NB: nothing gets output in the screen session window itself - if you want that then use tee 2>&1 | tee $TMPFILE # cat screen-test.sh #!/bin/sh # Send command to screen session # - if you have more than one screen session, you'll # need to find out the right session and use it # specifically. #screen -r 10345.root -X exec ${PWD}/screen-test2.sh screen -r -X exec ${PWD}/screen-test2.sh # Give job time to complete before continuing.... sleep 1 # Get output file name (was created in other script with mktemp) MYFILE=$(ls -rt /tmp/screen-test.*|tail -1) # Display file and remove it cat $MYFILE && rm $MYFILE # cat screen-test2.sh #!/bin/sh TMPFILE=$(mktemp -p /tmp screen-test.XXXXXX) ( echo "+====+ $TMPFILE +====+" echo "Running in dir: $(pwd)" echo "-----------------------" # command(s) to run in session to create desired output /bin/ls echo -e "=======================" ) 2>&1 > $TMPFILE -- Kind Regards AndrewM Andrew McGlashan Broadband Solutions now including VoIP _______________________________________________ screen-users mailing list screen-users@gnu.org http://lists.gnu.org/mailman/listinfo/screen-users