From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24306 invoked by alias); 15 Jan 2016 11:39:31 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21152 Received: (qmail 17942 invoked from network); 15 Jan 2016 11:39:28 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-IBM-Helo: d06dlp03.portsmouth.uk.ibm.com X-IBM-MailFrom: vogt@linux.vnet.ibm.com X-IBM-RcptTo: zsh-users@zsh.org Date: Fri, 15 Jan 2016 12:29:15 +0100 From: Dominik Vogt To: zsh-users@zsh.org Subject: Re: cd "" foo bug? Message-ID: <20160115112915.GA31148@linux.vnet.ibm.com> Reply-To: vogt@linux.vnet.ibm.com Mail-Followup-To: zsh-users@zsh.org References: <20160111112026.GA14816@linux.vnet.ibm.com> <20160111115804.00a8661b@pwslap01u.europe.root.pri> <20160115094526.GA11215@linux.vnet.ibm.com> <20160115104114.17aedcaf@pwslap01u.europe.root.pri> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160115104114.17aedcaf@pwslap01u.europe.root.pri> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16011511-0041-0000-0000-000006F30E91 On Fri, Jan 15, 2016 at 10:41:14AM +0000, Peter Stephenson wrote: > On Fri, 15 Jan 2016 10:45:26 +0100 > Dominik Vogt wrote: > > > cd -- $dir > > > > How is this supposed to work? The manual does not mention "--": > > You're correct that cd is funny with options, no doubt partly because of > -, so you can forget the "--". Yes, I think directories beginning > with "-" are intrinsically somewhat inconsistently handled in the > builtin (and presumably always have been). Any chance to at fix "--" so that cd -- -1 cd -- +1 cd -- -q actually work? Currently it's complicated to write a script that correctly invokes cd with some path P: IF P is - or + cd "./$P" ELSE IF P matches -[qsLP]## (in the sense of extended globbing) cd "./$P" ELSE IF P is -- cd -- -- ELSE cd "$P" With the suggested change you could simply do cd -- "$P" in all cases. Ciao Dominik ^_^ ^_^ -- Dominik Vogt IBM Germany