File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 1313set -e
1414set -o pipefail
1515
16+ # if not in console, use cat directly
17+ # check isatty in bash https://stackoverflow.com/questions/10022323
18+ [ ! -t 1 ] && exec cat " $@ "
19+
1620# NOTE: $'foo' is the escape sequence syntax of bash
1721readonly ec=$' \033 ' # escape char
1822readonly eend=$' \033 [0m' # escape end
@@ -21,9 +25,7 @@ readonly -a ECHO_COLORS=(31 32 37 34 33 35 36)
2125COUNT=0
2226colorEcho () {
2327 local color=" ${ECHO_COLORS[COUNT++ % ${#ECHO_COLORS[@]} ]}"
24- # check isatty in bash https://stackoverflow.com/questions/10022323
25- # if stdout is console, turn on color output.
26- [ -t 1 ] && echo " $ec [1;${color} m$@ $eend " || echo " $@ "
28+ echo " $ec [1;${color} m$@ $eend "
2729}
2830
2931# Bash read line does not read leading spaces https://stackoverflow.com/questions/29689172
You can’t perform that action at this time.
0 commit comments