I am building a bash
-script to visualize the various fonts available for figlet
using figlist
.
figlist
provides output like this:
Default font: standard
Font directory: /usr/local/Cellar/figlet/2.2.5/share/figlet/fonts
Figlet fonts in this directory:
3-d
3x5
5lineoblique
[...]
twopoint
univers
usaflag
weird
whimsy
Figlet control files in this directory:
646-ca
646-ca2
646-cn
646-cu
[...]
tsalagi
upper
ushebrew
uskata
utf8
The [...]s represent snipped output. My desired output is the following:
3-d
3x5
5lineoblique
[...]
twopoint
univers
usaflag
weird
whimsy
That is, I want the font names. I cannot guarantee the output format, but I don't want any control files, and I don't want the informational lines. I'm not sure, but I suspect all fonts must have one word names, so a regex solution might be possible. However, the control files have a similar format.
Current (hard-coded) solution:
read -a fonts <<<$(figlist | tail -n +4 | head -n 163)
This provides what I want, but requires that the length of the font list never changes, which I don't want.
I would prefer a solution in bash/standard commands/builtins, as that is the language in which I am writing the script, but if it can be obtained via a python one-liner or something similar (e.g. python -c <some command>
) then that is acceptable as well.