Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: 'whence' question



On Nov 8,  8:41pm, Peter Stephenson wrote:
}
} It's not worth factoring out the common code; it would need a whole
} heap of options passing in, passing back a value ignored in one case,
} passing in both a string and a pattern where only one is used each
} time...  Unless someone else can see a neater way.  Anyway, I will
} commit this and someone else can apply their elegant optimisations.

Cf. 33656.
 
} The results would look better with a bit more sorting, but that's a
} separate issue.

With 33653:

torch% noglob whence -m zsh*   
/usr/local/bin/zsh
/usr/local/bin/zsh-5.0.2-dev-0
/usr/local/bin/zsh-5.0.3
/usr/local/bin/zsh-5.0.4
/usr/local/bin/zsh-5.0.5
/usr/local/bin/zsh-5.0.7
/usr/local/bin/zsh.old
/etc/zshenv
/etc/zshrc
torch% noglob whence -am zsh*
/usr/local/bin/zsh-5.0.7
/usr/local/bin/zsh-5.0.3
/usr/local/bin/zsh
/usr/local/bin/zsh-5.0.4
/usr/local/bin/zsh.old
/usr/local/bin/zsh-5.0.5
/usr/local/bin/zsh-5.0.2-dev-0
/bin/zsh
torch% 

We've lost /etc/zshenv and /etc/zshrc in the -a case.  This isn't wrong,
because they're filtered out by iscom().  However:

torch% whence -mv zshenv 
zshenv is /etc/zshenv
torch% whence -av zshenv
zshenv not found
torch% whence -amv zshenv
torch% 

With 33656 the output of -amv is the same as -av in this latter case
(both print "zshenv not found").  Yes, an "else" could be added to the
"if (iscom(...))" in 33653 to get the "not found", but 33656 also
produces the -m sort order for -am when there is more than one match.

-- 
Barton E. Schaefer



Messages sorted by: Reverse Date, Date, Thread, Author