From: Peter Stephenson <pws@csr.com>
To: zsh-users@sunsite.dk
Subject: Re: FW: Full path with ksh emulation
Date: Fri, 06 Jan 2006 10:38:39 +0000 [thread overview]
Message-ID: <EXCHANGE03z2NoKMHG000001367@exchange03.csr.com> (raw)
In-Reply-To: <200601060047.k060lU37023709@rly01c.srv.mailcontrol.com>
"Tony Hasler" wrote:
> The bad news is that it didn't work. It tries to find the argument in
> $PATH, but when "." isn't there it reverts to the builtin. When "." is in
> the path you get an absolute path, but one with a "." in it. Only when the
> absolute path of "." is in $PATH and is the first place with an executable
> copy of the script does it seem to work.
Ah. You're right.
> if [[ $(builtin whence $1) == .* ]]; then
That looks good enough. You can optimise out the subprocess by changing
this to
if [[ $1 == .* || $(builtin whence $1) == .* ]]; then
the point being that in your case, where . isn't part of the path, you
are actually relying on the . being part of $1, so you never need the
code in the $(...).
You could probably change the patterns to (.|..)/* (as we're in
zsh-specific land) for a little extra safety but it doesn't make much
difference unless you have files starting with ".".
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
Your mail client is unable to display the latest news from CSR. To access our news copy this link into a web browser: http://www.csr.com/email_sig.html
next parent reply other threads:[~2006-01-06 10:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200601060047.k060lU37023709@rly01c.srv.mailcontrol.com>
2006-01-06 10:38 ` Peter Stephenson [this message]
2006-01-06 14:15 ` Annoying misfeature: ZSH completely hides output without newlines! Einar Huginson
2006-01-06 14:25 ` Vincent Lefevre
2006-01-06 14:26 ` Frank Terbeck
2006-01-06 14:35 ` Einar Huginson
2006-01-06 14:39 ` Jean Chalard
2006-01-06 0:47 FW: Full path with ksh emulation Tony Hasler
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=EXCHANGE03z2NoKMHG000001367@exchange03.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).