From: Dominik Vogt <vogt@linux.vnet.ibm.com>
To: zsh-users@zsh.org
Subject: Re: cd "" foo bug?
Date: Fri, 15 Jan 2016 12:29:15 +0100 [thread overview]
Message-ID: <20160115112915.GA31148@linux.vnet.ibm.com> (raw)
In-Reply-To: <20160115104114.17aedcaf@pwslap01u.europe.root.pri>
On Fri, Jan 15, 2016 at 10:41:14AM +0000, Peter Stephenson wrote:
> On Fri, 15 Jan 2016 10:45:26 +0100
> Dominik Vogt <vogt@linux.vnet.ibm.com> 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
> -<NUM>, 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 -<n> or +<n>
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
next prev parent reply other threads:[~2016-01-15 11:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-11 11:20 Dominik Vogt
2016-01-11 11:58 ` Peter Stephenson
2016-01-15 9:45 ` Dominik Vogt
2016-01-15 10:41 ` Peter Stephenson
2016-01-15 11:29 ` Dominik Vogt [this message]
2016-01-15 19:34 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160115112915.GA31148@linux.vnet.ibm.com \
--to=vogt@linux.vnet.ibm.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).