Bash functions for Terminals with ANSI support.
- Coloured text
- Titles and headings
- Text alignment and formatting
- Strip ANSI escape sequences
- Color conversions and aliases
Here some screenshots from the demo script in the examples folder.
Coloured text
ansi::fg red
echo Hello!
ansi::reset
echo "$(ansi::fg red)Hello!"
ansi::fg 2
echo Hello!
Headers
ansi::heading "Heading 1"
ansi::title "Title 1" "*"
Aligned text
ansi::right "LOREM IPSUM"
ansi::left_right "Summary" "0.10 $(ansi::fg blue)YES$(ansi::reset)" 80
On most typical terminals and operating systems ANSI Bash Function Library should work out of the box, if you don't see any colors or the output is not exactly what you expect, you probably have a terminal type that doesn't handle all the ANSI terminal codes used by ansi-bfl.
On Linux, FreeBSD or OpenBSD you could try to set
TERM=xterm-256color
On AIX and Solaris you could try with
TERM=dtterm
Reading the terminfo, termcap and term manual pages can help you to find out which terminal type should be set.
// EOF