Thomas Schweikle gab mir freundlicherweise ein Antwort auf eine Frage zum Thema "Output in Terminals":
Ich muss nochmal an eine bereits gestellte Frage anknüpfen. ein echo "Textausgabe" > /dev/console funktioniert nicht, wenn ich mich im X-Terminal befinde. Hat jemand einen Tricks, das auf den gerade laufenden X-Terminal auszugeben?
'who -l' zeigt alle laufenden Terminals an: : xch4008@teatime:~ > who -l : xch4008 :0 Mar 10 11:03 (console) : xch4008 pts/1 Mar 10 11:03 (:0.0) : xch4008 pts/0 Mar 10 11:03 (:0.0) : xch4008 pts/2 Mar 10 11:03 (:0.0) : xch4008 pts/3 Mar 10 11:52 (:0.0) : xch4008 pts/4 Mar 10 13:50 (datding.mydomain.de) : xch4008 pts/5 Mar 10 13:51 (teatime.mydomain:10.0)
mit 'tail file > /dev/pts/*' kann ich jetzt auf eine beliebiges Terminal beliebigen Text ausgeben: : xch4008@teatime:~ > tail winxx/Windows_98/lastlog.txt > /dev/pts/5 ^ Und das ist der Knackpunkt - wie erfahre ich denjenigen Terminal, auf dem ich mein wvdial gestartet habe? Es ist jedesmal eine beliebiges weiteres Fenster. Was ist das aktuelle Fenster?
Gruss! Hermann Flacke --------------------------------------------------------------------- To unsubscribe, e-mail: suse-linux-unsubscribe@suse.com For additional commands, e-mail: suse-linux-help@suse.com
Hermann Flacke wrote:
wie erfahre ich denjenigen Terminal, auf dem ich mein wvdial gestartet habe? Es ist jedesmal eine beliebiges weiteres Fenster. Was ist das aktuelle Fenster?
echo `find /proc/$$/fd -name 255 -printf %l` Die Variable $$ wird von der Shell gesetzt und enthaelt ihre PID. Wenn Du eine andere PID brauchst, kannst Du die natuerlich einfach ermitteln, z.B.: pid=`/sbin/pidof wvdial` echo `find /proc/$pid/fd -name 255 -printf %l` Noch besser waere es natuerlich, wenn Du erst ueberpruefen wuerdest, ob $pid wirklich eine (und nur =eine=!) PID enthaelt. Wenn mehrere gleichnamige Prozesse laufen, bekommst Du naemlich eine ganze Liste. Du kannst aber natuerlich auch einfach die erste PID herausschneiden: pid=`/sbin/pidof konsole|cut -f 1 -d " "` m. --------------------------------------------------------------------- To unsubscribe, e-mail: suse-linux-unsubscribe@suse.com For additional commands, e-mail: suse-linux-help@suse.com
Melchior FRANZ wrote:
Hermann Flacke wrote:
wie erfahre ich denjenigen Terminal, auf dem ich mein wvdial gestartet habe? [...] echo `find /proc/$$/fd -name 255 -printf %l`
Nachtrag: Statt 255 koennte auch ein andere Filedescriptor ratsam sein. Vor allem stderr (2) duerfte interessant sein. Und wenn nur das device der shell gesucht wird, ist natuerlich (wie Bernd schon geschrieben hat) `tty' vorzuziehen. m. --------------------------------------------------------------------- To unsubscribe, e-mail: suse-linux-unsubscribe@suse.com For additional commands, e-mail: suse-linux-help@suse.com
Melchior FRANZ wrote on Sun, 12 Mar 2000:
Melchior FRANZ wrote:
Hermann Flacke wrote:
wie erfahre ich denjenigen Terminal, auf dem ich mein wvdial gestartet habe? [...]
echo `find /proc/$$/fd -name 255 -printf %l`
Nachtrag: Statt 255 koennte auch ein andere Filedescriptor ratsam sein. Vor allem stderr (2) duerfte interessant sein. Und wenn nur das device der shell gesucht wird, ist natuerlich (wie Bernd schon geschrieben hat) `tty' vorzuziehen.
Das klappt aber nicht wenn ip-up vom pppd gestartet wird. Bei mir sind stdin, stdout und stderr alle /dev/null. tty leifert ebenfalls keine brauchbare Ausgabe. 255 existiert gar nicht. Ich habe es mit /proc/$$/fd/3 hinbekommen. CU Dirk -- Windooze is bootiful --------------------------------------------------------------------- To unsubscribe, e-mail: suse-linux-unsubscribe@suse.com For additional commands, e-mail: suse-linux-help@suse.com
participants (3)
-
a8603365@unet.univie.ac.at
-
dirk@pirschel.de
-
hermann.flacke@bluewin.de