Re: Redirect output to x-window in linux?
Dave Farrance wrote:
> Bill Marcum <bmarcum@iglou.com> wrote:
>
>> On Thu, 24 Aug 2006 14:11:51 GMT, Dave Farrance wrote:
>>> Is it possible for a bash script to test it it's not running in a
>>> terminal and if that's the case, pop open an x-window of some sort (in
>>> linux) and redirect the output of the remaining commands in that script
>>> to the x-window?
>>>
>> To test whether the program is running under X, [ -n "$DISPLAY" ]
>> Otherwise, you can redirect output to a file or pipe it to mail.
>>
>> { do_this; do_that; etc; } | xterm -hold -e cat
>> If there is a lot of output, you can use less instead of cat, or use the
>> -sl and -sb options to xterm.
>
> Looks good in principle, but doesn't work here for some reason. I tried:
>
> { echo 1; echo 2; } | xterm -hold -e cat
>
> ... in both Mandriva 2006 and Ubuntu 6.06 and although the xterm window
> opened, it remained completely blank.
>
mkfifo FIFO
xterm -hold -e 'cat FIFO' &
{commands generating data} > FIFO
|