Afficher un message
Vieux 24/08/2006, 18h50   #3
Dave Farrance
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Redirect output to x-window in linux?

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.

--
Dave Farrance
  Réponse avec citation
 
Page generated in 0,05832 seconds with 9 queries