I write:
$ infocmp -1 xterm ... colors#8, bold=\E[1m, blink=\E[5m, ... $ tput -Txterm colors && echo OK || echo err 8 OK $ tput -Txterm blink && echo OK || echo err ^[[5mOK
So I can use tput to check retminal capabilities.
Is this soution portable? Are there any another solutions?
Or may be I can stuck with solution:
$ [ $TERM = xterm ] && echo ok || echo err ok
One use is to set PS1 in .bashrc. Another for highliting output to take attention from sh script. I can use such solution:
PS1='bash# ' case "$TERM" in xterm*) PS1='\[\033[35m\]bash# \[\033[0m\]' ;; esac
which uses only built-in command of bash (so efficient) and work for all my cases but unfortunately does not portable.