terminfo
From Noah.org
Revision as of 17:55, 11 April 2014 by Root (talk | contribs) (Created page with 'Category: Engineering = Terminfo and Termcap = Don't use '''termcap'''; it's the old system. Use '''terminfo'''. == translate tput commands to echo strings == <pre> tput-…')
Terminfo and Termcap
Don't use termcap; it's the old system. Use terminfo.
translate tput commands to echo strings
tput-to-str(){ infocmp -E | sed -n -e "/_s_$@/s/^.*\"\(.*\)\";.*/\1/p"; }
You can use it like this:
This version extracts the characters that tput actually writes, but the string quoting format is not standard C or shell ('''echo -n -e''' won't work). <pre> tput-to-str(){( strace -s 1000 -e write tput $@ 2>&2 2>&1 ) | grep -o '"[^"]*"';}