Skip to content

Instantly share code, notes, and snippets.

@RichardBronosky
Created October 21, 2013 20:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save RichardBronosky/7090604 to your computer and use it in GitHub Desktop.
Save RichardBronosky/7090604 to your computer and use it in GitHub Desktop.
I created this gist to demo tput for this stackexchange answer: http://unix.stackexchange.com/questions/16429/#16433
#!/usr/bin/env bash
# tputdemo.sh
echo -e "\n$(tput bold) reg dim bld und tput-command$(tput sgr0)"
for i in $(seq 0 15); do
for k in sgr0 dim bold smul; do
echo -n " $(tput $k)$(tput setaf $i)Text$(tput sgr0)"
done
echo " \$(tput setaf $i)"
done
echo
echo ' Dim $(tput dim)'
echo ' Bold $(tput bold)'
echo ' Underline $(tput smul)'
echo ' Reset $(tput sgr0)'
echo -e "\n$(tput bold) bg blk wht brwht tput-command$(tput sgr0)"
for i in $(seq 0 15); do
echo -n "$(tput setab $i) Text $(tput sgr0)"
echo -n "$(tput setab $i)$(tput setaf 0)Text $(tput sgr0)"
echo -n "$(tput setab $i)$(tput setaf 7)Text $(tput sgr0)"
echo -n "$(tput setab $i)$(tput setaf 15)Text $(tput sgr0)"
echo " \$(tput setab $i)"
done
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment