sh bug?

From: Julian Elischer <julian_at_elischer.org>
Date: Fri, 28 Jan 2005 00:07:56 -0800
the man page for sh says:

----------------------------------------------------------------
    Grouping Commands Together
      Commands may be grouped by writing either

            (list)

      or

            { list; }

      The first form executes the commands in a subshell.  Note that built-in
      commands thus executed do not affect the current shell.  The second form
      does not fork another shell, so it is slightly more efficient.  Grouping
      commands together this way allows the user to redirect their output as
      though they were one program:

            { echo -n "hello"; echo " world"; } > greeting
-----------------------------------------------------------------------

however  echo $$
and
   ( echo $$ )

produce the same result.
in addition,

  ps -l
and
  ( ps -l )

show the same parent process for 'ps'

so it looks to me that () is acting the same as {}
and that neither is forking a new shell.

am I missing something?
Received on Fri Jan 28 2005 - 07:08:04 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:27 UTC