浏览代码

installer: allow for tput errors

tput may throw errors on invalid $TERM values, for example.
This shorthand syntax allows for that as well as for if tput
doesn't exist.
Marc Cornellà 5 年之前
父节点
当前提交
0824dcc9fb
共有 1 个文件被更改,包括 1 次插入5 次删除
  1. 1 5
      tools/install.sh

+ 1 - 5
tools/install.sh

@@ -52,11 +52,7 @@ error() {
 
 # Set up color sequences
 setup_color() {
-	if command_exists tput; then
-		ncolors=$(tput colors)
-	else
-		ncolors=0
-	fi
+	ncolors=$(tput colors 2>/dev/null) || ncolors=0
 
 	# Only use colors if connected to a terminal that supports them
 	if [ -t 1 ] && [ $ncolors -ge 8 ]; then