In the Info document of bash-4.4-beta it says:

    cd [-L|[-P [-e]] [-@] [DIRECTORY]

which is missing a closing bracket somewhere.

On the man page and in 'help cd' it says:

    cd [-L|[-P [-e]] [-@]] [dir]

At first glance this seems to say that -@ can only be used
when also -L is used.  On closer reading this is of course
not so, but the brackets being so wide apart makes this
somewhat hard to parse.

So I would suggest the following instead:

    cd [-L]|[-P [-e]] [-@] [dir]

Of course it is somewhat silly to have "optional | optional",
but this way it is much clearer to me that -@ is independent
and also a bit clearer that -e only goes with -P.

Attached patch makes the proposed change.

(I may have patched a wrong file, though -- it's unclear to me
why generated files are in the git repo.)

Benno

-- 
http://www.fastmail.com - The way an email service should be

From 4c4f3de6fbc3684915ef89ca7ba0922f8d8283cb Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensb...@justemail.net>
Date: Mon, 19 Oct 2015 13:47:41 +0200
Subject: [PATCH] cd: add a missing bracket to the synopsis in the Info manual

Also, for clarity, move the bracket in the synopsis on the
man page (and improve the formatting) and in 'help cd'.

Signed-off-by: Benno Schulenberg <bensb...@justemail.net>
---
 builtins/cd.def  |    2 +-
 doc/bash.1       |    2 +-
 doc/bashref.texi |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/builtins/cd.def b/builtins/cd.def
index 43a181a..3d7dbc0 100644
--- a/builtins/cd.def
+++ b/builtins/cd.def
@@ -77,7 +77,7 @@ static int xattrfd = -1;
 
 $BUILTIN cd
 $FUNCTION cd_builtin
-$SHORT_DOC cd [-L|[-P [-e]] [-@]] [dir]
+$SHORT_DOC cd [-L]|[-P [-e]] [-@] [dir]
 Change the shell working directory.
 
 Change the current directory to DIR.  The default DIR is the value of the
diff --git a/doc/bash.1 b/doc/bash.1
index 84913fc..cea53dd 100644
--- a/doc/bash.1
+++ b/doc/bash.1
@@ -7199,7 +7199,7 @@ The return value is 0 unless the shell is not executing a subroutine
 call or \fIexpr\fP does not correspond to a valid position in the
 call stack.
 .TP
-\fBcd\fP [\fB\-L\fP|[\fB\-P\fP [\fB\-e\fP]] [\-@]] [\fIdir\fP]
+\fBcd\fP [\fB\-L\fP]|[\fB\-P\fP [\fB\-e\fP]] [\fB\-@\fP] [\fIdir\fP]
 Change the current directory to \fIdir\fP.
 if \fIdir\fP is not supplied, the value of the
 .SM
diff --git a/doc/bashref.texi b/doc/bashref.texi
index 4e73d4a..a4ffa8f 100644
--- a/doc/bashref.texi
+++ b/doc/bashref.texi
@@ -3302,7 +3302,7 @@ The return status is zero unless @var{n} is not greater than or equal to 1.
 @item cd
 @btindex cd
 @example
-cd [-L|[-P [-e]] [-@@] [@var{directory}]
+cd [-L]|[-P [-e]] [-@@] [@var{directory}]
 @end example
 
 Change the current working directory to @var{directory}.
-- 
1.7.0.4

Reply via email to