summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-03-24 22:48:45 +0000
committerjilles <jilles@FreeBSD.org>2013-03-24 22:48:45 +0000
commite740fd1ca7e847599c7467d1112041207db09ec0 (patch)
tree3fa1fbc4660d33ede27ef6f389d72513f3cf2528 /bin/sh
parentac3bbd03701a982fe77067a278a16f6554d0e212 (diff)
downloadFreeBSD-src-e740fd1ca7e847599c7467d1112041207db09ec0.zip
FreeBSD-src-e740fd1ca7e847599c7467d1112041207db09ec0.tar.gz
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.
Diffstat (limited to 'bin/sh')
-rw-r--r--bin/sh/sh.115
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/sh/sh.1 b/bin/sh/sh.1
index 09d94f3..84dcdde 100644
--- a/bin/sh/sh.1
+++ b/bin/sh/sh.1
@@ -32,7 +32,7 @@
.\" from: @(#)sh.1 8.6 (Berkeley) 5/4/95
.\" $FreeBSD$
.\"
-.Dd January 22, 2013
+.Dd March 24, 2013
.Dt SH 1
.Os
.Sh NAME
@@ -1061,6 +1061,9 @@ A subshell environment may be implemented as a child process or differently.
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
@@ -1618,6 +1621,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.
OpenPOWER on IntegriCloud