From: Atom Smasher <atom@smasher.org>
To: zsh-users@sunsite.dk
Subject: Re: cd to a file
Date: Sun, 22 Apr 2007 03:12:21 +1200 (NZST) [thread overview]
Message-ID: <20070421151225.58926.qmail@smasher.org> (raw)
not nearly as elaborate as Frank Terbeck's function, but i think this
provides the basic functionality to cd to a file without breaking
anything. the "echo" command is very much optional...
cd() {
## cd to a file
if [ 1 = "${#}" ] && [ '-' != "${1}" ] && [ \! -d "${1}" ] && [ -d "${1:h}" ]
then
echo "correcting \"${1}\" to \"${1:h}\"" >&2
builtin cd "${1:h}"
else
builtin cd "${@}"
fi
}
--
...atom
________________________
http://atom.smasher.org/
762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
-------------------------------------------------
"We must have strong minds, ready to accept facts as they are."
-- President Harry Truman
"I don't care what the facts are."
-- President George H.W. Bush, 1988
next prev reply other threads:[~2007-04-21 15:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-06-19 12:43 More zsh tricks required please zzapper
2004-06-19 13:06 ` Christian Schneider
2004-06-20 12:19 ` Julius Plenz
2004-06-21 0:38 ` Drew Perttula
2007-04-16 14:40 ` cd to a file Andy Spiegl
2007-04-16 16:00 ` Frank Terbeck
2007-04-18 1:08 ` Andy Spiegl
2007-04-21 15:12 ` Atom Smasher [this message]
2007-04-22 18:18 ` Frank Terbeck
2007-04-23 8:45 ` Atom Smasher
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=20070421151225.58926.qmail@smasher.org \
--to=atom@smasher.org \
--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).