Stripping tput off when terminal is not xterm
This commit is contained in:
parent
16c864e161
commit
8435ff442b
12
Bash/header
12
Bash/header
@ -6,13 +6,25 @@ pullcmd='wget --timeout=5 -q -O -'
|
|||||||
## Visual Functions ##
|
## Visual Functions ##
|
||||||
# These function creates a visual indicator that a step has happened.
|
# These function creates a visual indicator that a step has happened.
|
||||||
function header () {
|
function header () {
|
||||||
|
if [[ "$TERM" =~ xterm* ]]; then
|
||||||
tput setaf 1; tput bold; echo $@; tput sgr0; return
|
tput setaf 1; tput bold; echo $@; tput sgr0; return
|
||||||
|
else
|
||||||
|
echo $@;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
function errorheader () {
|
function errorheader () {
|
||||||
|
if [[ "$TERM" =~ xterm* ]]; then
|
||||||
tput setaf 1 1>&2; tput bold 1>&2; echo "ERROR:" $@ 1>&2; tput sgr0 1>&2; return
|
tput setaf 1 1>&2; tput bold 1>&2; echo "ERROR:" $@ 1>&2; tput sgr0 1>&2; return
|
||||||
|
else
|
||||||
|
echo $@;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
function infoheader() {
|
function infoheader() {
|
||||||
|
if [[ "$TERM" =~ xterm* ]]; then
|
||||||
tput setaf 3; tput bold; echo $@; tput sgr0; return
|
tput setaf 3; tput bold; echo $@; tput sgr0; return
|
||||||
|
else
|
||||||
|
echo $@;
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
function colorstrip() {
|
function colorstrip() {
|
||||||
perl -e 'use strict; use warnings; while(<>) { s/\e\[[\d;]*m//g; print; }'
|
perl -e 'use strict; use warnings; while(<>) { s/\e\[[\d;]*m//g; print; }'
|
||||||
|
Loading…
Reference in New Issue
Block a user