diff options
author | Henrik Holm <henrik@henrikholm.com> | 2014-03-29 10:14:37 -0400 |
---|---|---|
committer | Henrik Holm <henrik@henrikholm.com> | 2014-03-30 10:34:13 -0400 |
commit | f46d06dae19f691e6666d4836766e9eb69d2e51b (patch) | |
tree | 99aa51264bbc9d29d355ddf61a5eb049f9804758 /tools/install.sh | |
parent | 70dfb91b982b91cd2bd052124e8b65b774f66db1 (diff) | |
download | zsh-f46d06dae19f691e6666d4836766e9eb69d2e51b.tar.gz zsh-f46d06dae19f691e6666d4836766e9eb69d2e51b.tar.bz2 zsh-f46d06dae19f691e6666d4836766e9eb69d2e51b.zip |
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
[~]$
Diffstat (limited to 'tools/install.sh')
-rwxr-xr-x | tools/install.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/install.sh b/tools/install.sh index 71e19a389..fc7ad70cf 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -10,7 +10,7 @@ if [ -d "$ZSH" ]; then fi 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" exit } |