PDA

View Full Version : [ubuntu] redirect input terminal



cris_1986
April 2nd, 2012, 01:42 PM
hy,
in a terminal i open a new terminal:

gnome-terminal

now i have 2 terminal: the main terminal and the second terminal.
Can i redirect the keyboard input from the main to the second?

Example:
Main terminal:

echo hello world

second terminal:

hello world

Paddy Landau
April 2nd, 2012, 07:03 PM
You can redirect both input and output for child processes using coproc. However, it does not work for a Bash terminal, because the input and output are internal to the terminal.

You could have output from the second terminal redirect to a file (I suggest a RAM file; create a temporary file in /run/shm using mktemp), and have the first terminal watch for changes to the file using tail --follow or inotifywait.