diff options
author | Yannick Eckey <yannick.eckey@googlemail.com> | 2015-10-15 15:37:30 +0200 |
---|---|---|
committer | Yannick Eckey <yannick.eckey@googlemail.com> | 2015-10-16 22:27:46 +0200 |
commit | 75e619b72421e7330011c8bda5f99af5231a8b7d (patch) | |
tree | aa8a54393aefd2a502903bc8e0f0e361ff2cdec5 /tools/install.sh | |
parent | 306e3e7ea0f2aef2ab9e3a51986c34f7296a3ab2 (diff) | |
download | zsh-75e619b72421e7330011c8bda5f99af5231a8b7d.tar.gz zsh-75e619b72421e7330011c8bda5f99af5231a8b7d.tar.bz2 zsh-75e619b72421e7330011c8bda5f99af5231a8b7d.zip |
Fix install.sh/upgrade.sh for tput-less systems
@fcrozat's original fix assumes `which` not to output anything to STDOUT
in case the command is not found. That is not necessarily true on all
systems. A better solution is to check the return value instead.
Fixes #4376
Diffstat (limited to 'tools/install.sh')
-rwxr-xr-x | tools/install.sh | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/install.sh b/tools/install.sh index 5633320a8..542bf97c2 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -2,9 +2,8 @@ set -e # Use colors, but only if connected to a terminal, and that terminal # supports them. -tput=$(which tput) -if [ -n "$tput" ]; then - ncolors=$($tput colors) +if which tput >/dev/null 2>&1; then + ncolors=$(tput colors) fi if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then RED="$(tput setaf 1)" |