mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-22 05:40:08 +00:00
Correct redirection of output from 'hash'
The intention of the redirection to /dev/null is to hide the output 'hash: no such command: git' since we rely on the exit status. However, the output goes to stderr, so it's stderr that needs to be redirected. For completeness, we redirect both stderr and stdout using '2>&1'. Example: [~]$ hash git > /dev/null [~]$ PATH='' [~]$ hash git > /dev/null hash: no such command: git [~]$ hash git > /dev/null 2>&1 [~]$
This commit is contained in:
parent
70dfb91b98
commit
f46d06dae1
1 changed files with 1 additions and 1 deletions
|
@ -10,7 +10,7 @@ if [ -d "$ZSH" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
|
echo "\033[0;34mCloning Oh My Zsh...\033[0m"
|
||||||
hash git >/dev/null && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
|
hash git >/dev/null 2>&1 && /usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $ZSH || {
|
||||||
echo "git not installed"
|
echo "git not installed"
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue