The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
GNU screen neked UNIX for Advanced & Expert Users 2 09-25-2008 09:30 PM
I won't get the login screen balarajum AIX 2 04-02-2007 09:58 AM
clear screen in g++ gefa High Level Programming 2 04-22-2006 06:00 AM
printing to the screen google UNIX for Advanced & Expert Users 2 10-23-2003 08:19 PM
screen capture merlin UNIX for Dummies Questions & Answers 10 02-10-2003 11:45 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 12-20-2006
Registered User
 

Join Date: Dec 2006
Posts: 6
Help with screen

Hello everyone!

I'm trying to figure out how to send commands from one screen to another.
For example i wish to send a simple "ls -all" from screen #1 to screen #2,
can it be done, and how?

Thank you!
Reply With Quote
Forum Sponsor
  #2  
Old 12-20-2006
Registered User
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,397
what is meant by sending commands from one screen to another?
Reply With Quote
  #3  
Old 12-20-2006
Registered User
 

Join Date: Dec 2006
Posts: 6
Well this is the deal:
i am in screen #1 and i wish to send a command to screen #2.

The thing is that using screen -x i can have 2 terminals open and monitor 2 screens. I wish to be able to control both screens from either of them.
So if i have two windows open on my desktop, and i work in a window with screen #1, i wish to be able to send commands to a screen #2 that is open in another window on my desktop.

I need this to have several automated processes, for example: feed in screen #1 triggers events in screen #2.
Reply With Quote
  #4  
Old 12-20-2006
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
I think you are talking about the screen utility, right?
What I do not know is what you mean when you say "send commands". I can think of two possibilities:
- You want to send commands that run on the other screen (shell). For now, I'm not aware of any way to do this.
- You want to display the o/p of the commands you execute in one screen on the other. In this case, you need to know the terminal asociated to the screen session and redirect the output there:

Code:
screen 1                                     screen 2
--------                                     --------
$ tty                                        $ tty
/dev/pts/3                                   /dev/pts/4
$ echo Helo | tee -a /dev/pts/4 
Helo                                         Helo
Regards
Reply With Quote
  #5  
Old 12-20-2006
Registered User
 

Join Date: Dec 2006
Posts: 6
Thank you for your reply Grial, however this just sends the output from
/dev/pts/3 to /dev/pts/4.

I wish to do the following from /dev/pts/3:

<funcname> /dev/pts/4 echo hello

where <funcname> is the program that enables me to send a command to /dev/pts/4 so the command executes on /dev/pts/4.

Thank you!

Last edited by Gurth; 12-20-2006 at 04:46 AM.
Reply With Quote
  #6  
Old 12-20-2006
Registered User
 

Join Date: Dec 2006
Posts: 6
I have been able to come close using "screen" utility.
If i enter the command prompt of the "screen" i can then do:

Code:
at 1# "ls -al"
The problem is that i can't get an escape char from the shell. I need to type
ctrl-a-: to get to the command prompt of the screen utility.

Can i perhaps prefix the

at 1# "ls -al"

with some char sequence to emulate the escape char?
Reply With Quote
  #7  
Old 12-20-2006
grial's Avatar
El UNIX es como un toro
 

Join Date: Jun 2006
Location: Madrid (Spain)
Posts: 531
What about something like this?

In one screen:
Code:
mkfifo namedpipe
export COMMAND=ls
$COMMAND; echo $COMMAND > namedpipe
In the other screen:
Code:
while true; do $(cat namedpipe); done &
(bash+linux)
Regards.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 04:28 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0