Yes, it's possible to build an image, with use of external tools (bash has no built-in graphics APIs). As examples, you could:
Use XMLStarlet to build a SVG file describing the graphic you want, and invoke Inkscape in command-line mode to render it to a file (.png, etc).
Use GraphicsMagick in command-line mode (with the -draw argument to the convert command).
If, by contrast, you want to render that image to the terminal, you can use your terminal font's available line-drawing characters and color support, but will not have the same level of detailed control (ability to select fonts, select pixel-specific locations, etc).
The \u2500s get replaced with horizontal bars, the \u252c with a horizontal bar with a tee pointing down, the \u2534 with a horizontal bar with a tee pointing up, etc.
The %ss get replaced with corresponding arguments -- "$(tput setf red)" to make the foreground text red (or no character at all, if the current terminal doesn't support color), the "$(tput setf black)"... well, does the obvious thing.
Yes, it's possible to build an image, with use of external tools (bash has no built-in graphics APIs). As examples, you could:
.png
, etc).-draw
argument to theconvert
command).If, by contrast, you want to render that image to the terminal, you can use your terminal font's available line-drawing characters and color support, but will not have the same level of detailed control (ability to select fonts, select pixel-specific locations, etc).
Look at the list of characters in http://en.wikipedia.org/wiki/Box-drawing_character
If your user supports a Unicode-aware terminal, then, you could do something like:
The
\u2500
s get replaced with horizontal bars, the\u252c
with a horizontal bar with a tee pointing down, the\u2534
with a horizontal bar with a tee pointing up, etc.The
%s
s get replaced with corresponding arguments --"$(tput setf red)"
to make the foreground text red (or no character at all, if the current terminal doesn't support color), the"$(tput setf black)"
... well, does the obvious thing.