Re: Was ist der Unterschied zwischen ';' und '&&' ?
On Mon, Feb 25, 2008 at 05:20:59PM +0100, Christian Knorr wrote:
> ich kenne das Semikolon ';' als Trenner um mehrere Befehle in eine Zeile zu
> packen. Diese werden dann der Reihe nach abgearbeitet.
>
> Doch nun stolpere ich über: "aptitude update && aptitude upgrade".
> Ich habe es ausgeführt, die Befehle werden nacheinander ausgeführt.
>
> Was bedeutet nun das Doppel-Und, und warum nimmt man nicht ';'?
Hallo Christian,
bei ';' werden die Befehle auf jeden Fall nacheinander ausgeführt,
während bei '&&' der 2. Befehl nur dann ausgeführt wird, wenn der 1. mit
exitcode 0 endet, sprich ohne Fehler ausgeführt wird.
Sieht dir folgendes Paket an, da ist das alles sehr gut erklärt. Finde
ich eine der besten Einführungen in Bash-Scripting.
Package: abs-guide
Description: The Advanced Bash-Scripting Guide
An in-depth exploration of the art of shell scripting.
.
This tutorial assumes no previous knowledge of scripting or
programming, but progresses rapidly toward an intermediate/advanced
level of instruction ... all the while sneaking in little snippets
of UNIX(R) wisdom and lore. It serves as a textbook, a manual for
self-study, and a reference and source of knowledge on shell
scripting techniques. The exercises and heavily-commented examples
invite active reader participation, under the premise that the only
way to really learn scripting is to write scripts.
.
This book is suitable for classroom use as a general introduction to
programming concepts.
Hth Michael
--
Es sprach der Pfaff' zum Fürsten:
"Halt' Du sie arm, ich halt' sie dumm."
Reply to: