On Tue, Oct 15, 2013 at 03:35:10PM +0200, Ralph Meyer wrote:
[...]
> Gibt es einen Unterschied zwischen :
> 
> --------------------------------------
> #!/bin/bash
> 
> if (rpm -q rsyslog &> /dev/null) ; then
[...]
> und
[...]
> if rpm -q rsyslog &> /dev/null ; then

man bash:

   Compound Commands
       A compound command is one of the following:

       (list) list is executed in a subshell environment (see COMMAND EXECUTION 
ENVIRONMENT below).  Variable  assignments  and  builtin  commands
              that  affect  the  shell’s environment do not remain in effect 
after the command completes.  The return status is the exit status of
              list.

Die Befehlsliste in runden Klammern wird in einer Subshell ausgeführt.
Die Bash startet als Kindprozess eine neue Shell, führt die Befehle darin aus 
und liefert nach Beendigung der Shell den Return Code zurück.


-- 
EDV Frank Bergmann                           Tel.     05221-9249753
LPIC-3 Linux Professional                    Fax      05221-9249754
Pödinghauser Str. 5                          email    [email protected]
32051 Herford                                USt-IdNr DE237314606
-- 
Linux mailing list [email protected]
subscribe/unsubscribe: http://lug-owl.de/mailman/listinfo/linux
Hinweise zur Nutzung: http://www.lug-owl.de/Mailingliste/hints.epo

Antwort per Email an