LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sending command from one terminal to another. (https://www.linuxquestions.org/questions/linux-newbie-8/sending-command-from-one-terminal-to-another-945114/)

alireza6485 05-15-2012 01:43 PM

Sending command from one terminal to another.
 
Hello,
I am running a program in a terminal.
this program is just printing random words.
I can change the color of each word by entering the first character of the color(for example G for Green).
I want to write a bash code that runs in a different terminal and sends different characters to terminal 1 (the one showing the rectangle) to change the color automatically and constantly.

my word program is running in /dev/pts/1

i tried to do the following:

echo G > /dev/pts/1 , all it does is printing G in terminal 1. nothing happens to the color. how can I make it execute and change the color of the words?

zXi 05-15-2012 01:54 PM

have you tried echo hello|grep --color=green > /dev/pts/1

alireza6485 05-15-2012 02:02 PM

Quote:

Originally Posted by zXi (Post 4679142)
have you tried echo hello|grep --color=green > /dev/pts/1

yeah and it did not work...
color is not the case... lets say if you press 1 it generates a word that starts with A.
my question is how can I make sure what i sent from terminal 2 is evaluated?

pan64 05-15-2012 02:06 PM

I tried ls -l > /dev/pts/1 and all the colors transferred successfully.
So you need to know the terminal color codes and you can send them with that redirection too. You can have an overview here: http://www.bo.infn.it/alice/alice-do...ex/node15.html


All times are GMT -5. The time now is 09:25 AM.