From 094a9a6e282c46894711c905eb2db8b77ace05fc Mon Sep 17 00:00:00 2001 From: Aitor Guevara <428243+aitorciki@users.noreply.github.com> Date: Fri, 15 Sep 2017 12:13:25 +0200 Subject: [PATCH] silent `which nvm` error in lazy load GNU `which` prints an error to stderr when a binary is not found, that is displayed with every new terminal startup when zsh-nvm is in lazy load mode: `/usr/local/bin/gwhich: no nvm in (...)` This patch redirects `which` errors to `/dev/null` while keeping stdout output available. --- zsh-nvm.plugin.zsh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh-nvm.plugin.zsh b/zsh-nvm.plugin.zsh index 83967b7..a672ed7 100644 --- a/zsh-nvm.plugin.zsh +++ b/zsh-nvm.plugin.zsh @@ -92,7 +92,7 @@ _zsh_nvm_lazy_load() { local cmds cmds=() for bin in $global_binaries; do - [[ "$(which $bin)" = "$bin: aliased to "* ]] || cmds+=($bin) + [[ "$(which $bin 2> /dev/null)" = "$bin: aliased to "* ]] || cmds+=($bin) done # Create function for each command