From 237e6d817fcd3f1a8c20293d8f5d69a3270a40fd Mon Sep 17 00:00:00 2001 From: Devin Christensen Date: Mon, 29 Apr 2013 10:53:39 -0600 Subject: [PATCH] Fix the command checks in the debian plugin The previous implementation made the assumption that `which` would return a path when `sudo` and/or `aptitude` were installed; however, when a command is aliased, e.g., `nocorrect sudo`, no path is returned, causing a false negative in the test. --- plugins/debian/debian.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh index 55b90e379..7cd4902f6 100644 --- a/plugins/debian/debian.plugin.zsh +++ b/plugins/debian/debian.plugin.zsh @@ -6,14 +6,14 @@ # Use aptitude if installed, or apt-get if not. # You can just set apt_pref='apt-get' to override it. -if [[ -e $( which aptitude 2>&1 ) ]]; then +if whence aptitude > /dev/null; then apt_pref='aptitude' else apt_pref='apt-get' fi # Use sudo by default if it's installed -if [[ -e $( which sudo 2>&1 ) ]]; then +if whence sudo > /dev/null; then use_sudo=1 fi