diff options
author | Roy Marples <roy@marples.name> | 2007-12-14 12:16:05 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-12-14 12:16:05 +0000 |
commit | 5541d3e3856ba2ef7071a480b49dbef3321c64a5 (patch) | |
tree | 740440bdb479a5122e20d90a2804fdf6dd7f47e6 /sh | |
parent | 7a18054fbed634616c925135b03536f1b9492e6e (diff) |
We should only do colours if fd1 is a terminal by default
Diffstat (limited to 'sh')
-rw-r--r-- | sh/functions.sh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sh/functions.sh b/sh/functions.sh index 00828f54..4c8843e8 100644 --- a/sh/functions.sh +++ b/sh/functions.sh @@ -171,8 +171,18 @@ for arg; do esac done -if [ -z "${GOOD}" ] && yesno ${EINFO_COLOR:-YES}; then - eval $(eval_ecolors) +if [ -t 1 ] && yesno "${EINFO_COLOR:-YES}"; then + if [ -z "${GOOD}" ]; then + eval $(eval_ecolors) + fi +else + # We need to have shell stub functions so our init scripts can remember + # the last ecmd + for _e in ebegin eend error errorn einfo einfon ewarn ewarnn ewend \ + vebegin veend veinfo vewarn vewend; do + eval "${_e}() { local _r; /lib/rc/bin/${_e} \"\$@\"; _r=$?; \ + export EINFO_LASTCMD=${_e}; return \$_r; }" + done fi # vim: set ts=4 : |