Mailinglist Archive: opensuse (818 mails)

< Previous Next >
Re: [opensuse] different types of shell scripts
  • From: Greg Freemyer <greg.freemyer@xxxxxxxxx>
  • Date: Fri, 23 Sep 2011 17:19:06 -0400
  • Message-id: <>
On Fri, Sep 23, 2011 at 5:02 PM, Philipp Thomas <Philipp.Thomas2@xxxxxxx> wrote:
On Thu, 22 Sep 2011 21:13:16 +0800, George Olson <grglsn765@xxxxxxxxx>

Ah, ok, let me see if I comprehend this correctly. So the first example
won't create a child process

Nearly right :) The shell always creates a new process, be it for
binary programs or an interpreter for a script (a shell, sed, awk,
perl etc.). As others wrote, '.' means "let the current shell run the
given script".

To be pedantic the above is either a little strong or unclear (I'm not
sure which).

Suppose I have a "file" (not a script) that has content:

echo $TEST_DEV

If I source that (. filename) it will not create a new process. The
shell itself is able to process those commands. (It has a built-in
echo command.)

If I execute the above (./filename or just plain filename) then a new
shell child process is invoked to run the commands.

If I modify the file to say:

/bin/echo $TEST_DEV
echo $TEST_DEV

Then when I source the file, a child process (/bin/echo) is launched,
but only for that one command, the first and last are still processed
by the original shell.

And if I execute the file I get both a child shell process and a
grandchild /bin/echo process.

To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
Follow Ups