Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am writing a shell script and I would like to write commands in the script but redirect the output to other konsole sessions. (using kde)

share|improve this question

migrated from stackoverflow.com Mar 23 '13 at 2:48

This question came from our site for professional and enthusiast programmers.

2 Answers 2

You can pipe the output to a log file which is tailed by other sessions.

In any other terminal:

touch foo && tail -f foo

In the "main" terminal:

script.sh > foo
share|improve this answer

First, look for the number that identifies the current tty session; lets consider the number as X:

| terminal 1               | terminal 2                |
 ------------------------------------------------------
| $ tty                    | $                         |
| /dev/pts/X               |                           |

Then, use the given number to write to the tty selected:

| terminal 1               | terminal 2                |
 ------------------------------------------------------
| $ tty                    | $ echo "foo" > /dev/pts/X |
| /dev/pts/X               |                           |

And it will produce:

| terminal 1               | terminal 2                |
 ------------------------------------------------------
| $ tty                    | $ echo "foo" > /dev/pts/X |
| /dev/pts/X               |                           |
| foo                      |                           |
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.