Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2005 00:07:56 -0800
From:      Julian Elischer <julian@elischer.org>
To:        Current <freebsd-current@freebsd.org>
Subject:   sh bug?
Message-ID:  <41F9F2DC.7000907@elischer.org>

next in thread | raw e-mail | index | archive | help
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?




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41F9F2DC.7000907>