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

Re: Why doesn't cd ignore files when you type say "cd fred*"



On Dec 4,  2:54pm, 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 .

Congratulations, you win a no-prize for accurate guessing.

} But can clever zsh be configued to avoid this behaviour.

You could always use a wrapper like this:

	function cd {
	    local -a dirs
	    dirs=( "${^@}"(-/N) )
	    if (( $#dirs == 1 ))
	    then builtin cd $dirs
	    else builtin cd "$@"
	    fi
	}

However, that might sometimes foil use of the two-argument form of "cd".



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