sh bug?

Julian Elischer julian at elischer.org
Fri Jan 28 00:08:04 PST 2005


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?




More information about the freebsd-current mailing list