From: Peter Stephenson <pws@csr.com>
To: zsh-users@sunsite.dk
Subject: Re: Why doesn't cd ignore files when you type say "cd fred*"
Date: Thu, 04 Dec 2003 15:37:54 +0000 [thread overview]
Message-ID: <4222.1070552274@csr.com> (raw)
In-Reply-To: "zzapper"'s message of "Thu, 04 Dec 2003 14:54:35 GMT." <kohusvg6jgqkqqtbc5th8h12b61iomo1gr@4ax.com>
zzapper wrote:
> Why doesn't cd ignore files when you type say "cd fred*" and there
> exists a file frederick.txt and a directory frederick ??
>
> I guess it's becauses the FNG handling fred* doesn't know that it's
> output is to be passed to cd .
It also doesn't know whether or not you want error checking.
> But can clever zsh be configued to avoid this behaviour.
>
> Could I tell cd to ignore files ending say .html,.txt etc
Use a wrapper. It's not 100% accurate in guessing what form of cd you
are using, but it will work the vast majority of the time.
cd() {
local -a dirs
local d
for d in $*; do
[[ -d $d ]] && dirs=($dirs $d)
done
if (( ${#dirs} == 1 )); then
builtin cd $dirs
else
# Assume it's something like e.g. `cd SOURCE REPLACE'
builtin cd "$@"
fi
}
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.
www.mimesweeper.com
**********************************************************************
next prev parent reply other threads:[~2003-12-04 15:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-04 14:54 zzapper
2003-12-04 15:37 ` Peter Stephenson [this message]
2003-12-04 16:47 ` zzapper
2003-12-05 10:54 ` Oliver Kiddle
2003-12-05 11:06 ` zzapper
2003-12-05 14:27 ` Oliver Kiddle
2003-12-04 17:30 ` Bart Schaefer
2003-12-04 20:50 ` zzapper
2003-12-04 22:56 ` Pavol Juhas
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=4222.1070552274@csr.com \
--to=pws@csr.com \
--cc=zsh-users@sunsite.dk \
/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).