Mailinglist Archive: opensuse-de (6551 mails)

< Previous Next >
Re: bash Probleme
  • From: Thomas Hertweck <Thomas.Hertweck@xxxxxxxxxxxxxxxxxxxx>
  • Date: Mon, 05 Aug 2002 14:42:12 +0200
  • Message-id: <3D4E72A4.DF9C3104@xxxxxxxxxxxxxxxxxxxx>
Bernd Obermayr schrieb:
Da bin ich platt ;)

Mit dem Script von Sascha gehts nicht, auch nicht mit
declare. Allerdings:
ps aux | grep "bash" > .tmp
while read line
echo $running
done < .tmp
echo $running
rm .tmp
geht wieder.
Es liegt wohl an der seltsamen (und unnötigen) Konstruktion
mit der Pipe..

Aus dem Manual zu "bash":

Each command in a pipeline is executed as a separate process (i.e., in
a subshell). [...] If a command is terminated by the control operator &,
the shell executes the command in the background in a subshell. [...]
"(list)": list is executed in a subshell. [...] Command substitution and
asynchronous commands are invoked in a subshell environment that is a
duplicate of the shell environment, except that traps caught by the shell
are reset to the values that the shell inherited from its parent at
invocation. Builtin commands that are invoked as part of a pipeline are
also executed in a subshell environment. Changes made to the subshell
environment cannot affect the shell's execution environment.

Da stehts eigentlich, oder? :-)

Thomson *...der hier wieder mal was gelernt hat*

Thomas Hertweck, Geophysicist
Geophysical Institute, University of Karlsruhe

< Previous Next >