Re: Shell mit Seltsamkeiten

From: Marc Santhoff <M.Santhoff(at)t-online.de>
Date: Fri, 14 Apr 2006 22:41:03 +0200

Am Freitag, den 14.04.2006, 18:13 +0200 schrieb Sven Amonat:
> Hi,
>
> Marc Santhoff schrieb:
> > Am Freitag, den 14.04.2006, 17:35 +0200 schrieb Marc Santhoff:
> >> sh -c "xwininfo -root | grep Width > /tmp/OOo-macrotest.txt"
> >
> > Das ist natürlich ein Kopierfehler, auch so:
> >
> > $ sh -c "xwininfo -root | grep Width | awk '{print $2}' > /tmp/OOo-macrotest.txt"
> > $ cat /tmp/OOo-macrotest.txt
> > Width: 1600
> >
> > geht es nicht.
>
> Da schlägt wieder die Variablenexpansion zu, $2 richtig esacped geht:
>
> $ sh -c "xwininfo -root | grep Width | awk '{print \$2}' > \
> /tmp/OOo-macrotest.txt"
> $ cat /tmp/OOo-macrotest.txt
> 1280

Komisch, wenn ich es so mache passiert das:

$ sh -c "xwininfo -root | grep Width | awk '{print \$2}' > /tmp/OOo-macrotest.txt"
awk: cmd. line:1: {print \}
awk: cmd. line:1: ^ backslash not last character on line

Ah ja, langsam komm' ich dahinter, ich habe seit der Installation nie
die Idee gehabt, die standardmäßig gewählte csh auszutauschen:

$ sh
$ sh -c "xwininfo -root | grep Width | awk '{print \$2}'
> /tmp/OOo-macrotest.txt"
$ cat /tmp/OOo-macrotest.txt
1600

Wenn ich das aus einer sh auf der Konsole mache, geht's. Und aus OOo
1.1.3 auch. Also doch ein Grund, tcsh zu verklappen ...

> Zumindest unter OpenOffice 2.0 funktioniert dieses Basic-Skript:
>
> tmpname = "/tmp/OOo-macrotest.txt"
> cmd = "xwininfo -root | grep Width | awk '{print $2}'"
> shell("sh", 0, "-c " + chr(34) + cmd + " > " + tmpname + chr(34), TRUE)

Prima, vielen Dank!

Marc

To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org
with "unsubscribe de-bsd-questions" in the body of the message
Received on Fri 14 Apr 2006 - 22:41:52 CEST

search this site