From owner-svn-src-stable@FreeBSD.ORG Wed Jul 3 21:22:47 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id B376E7A7; Wed, 3 Jul 2013 21:22:47 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id A586C1925; Wed, 3 Jul 2013 21:22:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r63LMlNn022205; Wed, 3 Jul 2013 21:22:47 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r63LMlgV022204; Wed, 3 Jul 2013 21:22:47 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201307032122.r63LMlgV022204@svn.freebsd.org> From: Jilles Tjoelker Date: Wed, 3 Jul 2013 21:22:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r252609 - stable/9/bin/sh X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 03 Jul 2013 21:22:47 -0000 Author: jilles Date: Wed Jul 3 21:22:47 2013 New Revision: 252609 URL: http://svnweb.freebsd.org/changeset/base/252609 Log: MFC r248692: sh(1): Mention possible ambiguities with $(( and ((. In some other shells, things like $((a);(b)) are command substitutions. Also, there are shells that have an extension ((ARITH)) that evaluates an arithmetic expression and returns status 1 if the result is zero, 0 otherwise. This extension may lead to ambiguity with two subshells starting in sequence. Modified: stable/9/bin/sh/sh.1 Directory Properties: stable/9/bin/sh/ (props changed) Modified: stable/9/bin/sh/sh.1 ============================================================================== --- stable/9/bin/sh/sh.1 Wed Jul 3 21:21:54 2013 (r252608) +++ stable/9/bin/sh/sh.1 Wed Jul 3 21:22:47 2013 (r252609) @@ -32,7 +32,7 @@ .\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95 .\" $FreeBSD$ .\" -.Dd November 5, 2011 +.Dd March 24, 2013 .Dt SH 1 .Os .Sh NAME @@ -1061,6 +1061,9 @@ A subshell environment may be implemente If job control is enabled in an interactive shell, commands grouped in parentheses can be suspended and continued as a unit. .Pp +For compatibility with other shells, +two open parentheses in sequence should be separated by whitespace. +.Pp The second form never forks another shell, so it is slightly more efficient. Grouping commands together this way allows the user to @@ -1604,6 +1607,16 @@ and .Ic times returns information about the same process if they are the only command in a command substitution. +.Pp +If a command substitution of the +.Li $( +form begins with a subshell, +the +.Li $( +and +.Li ( +must be separated by whitespace +to avoid ambiguity with arithmetic expansion. .Ss Arithmetic Expansion Arithmetic expansion provides a mechanism for evaluating an arithmetic expression and substituting its value.