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

Re: cd to a file

On Sun, 22 Apr 2007, Frank Terbeck wrote:

cd() {
   ## cd to a file
   if [ 1 = "${#}" ] && [ '-' != "${1}" ] && [ \! -d "${1}" ] && [ -d "${1:h}" ]
     echo "correcting \"${1}\" to \"${1:h}\"" >&2
     builtin cd "${1:h}"
     builtin cd "${@}"

This breaks things like 'cd -2', 'cd +2' or 'cd +'.

i haven't used those... back to the drawing board...


 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808

	Democracy, n.:
		A government of the masses. Authority derived
	through mass meeting or any other form of direct expression.
	Results in mobocracy. Attitude toward property is
	communistic... negating property rights. Attitude toward
	law is that the will of the majority shall regulate, whether
	it is based upon deliberation or governed by passion,
	prejudice, and impulse, without restraint or regard to
	consequences. Result is demagogism, license, agitation,
	discontent, anarchy.
		-- U. S. Army Training Manual
		No. 2000-25 (1928-1932), since withdrawn.

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