Peter Ross <Peter.Ross(at)alumni.tu-berlin.de> wrote:
> Ich hätte gern
>
> {Kommando1 || exit} | Kommando2
>
> Wenn Kommando1 daneben geht, dann bitte raus aus dem Skript, ansonsten das
> Ergebnis nach Kommando2 pipen.
Nein, das geht leider nicht. Der Exit-Status von Kommando1
steht ja erst fest, wenn dieses beendet ist, und zu diesem
Zeitpunkt ist natürlich auch Kommando2 schon längst gestar-
tet. Für die meisten praktischen Anwendungen kann man da-
von ausgehen, daß alle Teile einer Pipe quasi gleichzeitig
gestartet werden. Eine Pipe hat ja auch nur einen verhält-
nismäßig kleinen Puffer und kann keine beliebig umfangrei-
chen Ausgaben zwischenspeichern.
Wenn Kommando2 keinesfalls gestartet werden darf, falls
Kommando1 schiefgeht, dann wirst Du nicht darum herumkom-
men, eine Temporärdatei zu verwenden, z.B. so:
if Kommando1 > foo.tmp; then
Kommando2 < foo.tmp
rm foo.tmp
else
exit 1
fi
Gruß
Olli
-- Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "In headlines today, the dreaded killfile virus spread across the country adding aol.com to people's usenet kill files everywhere. The programmer of the virus still remains anonymous, but has been nominated several times for a Nobel Peace Prize." -- Mark Atkinson To Unsubscribe: send mail to majordomo(at)de.FreeBSD.org with "unsubscribe de-bsd-questions" in the body of the messageReceived on Wed 23 Apr 2003 - 11:15:27 CEST