Tech Tip: Using Figlet to Spice Up Your Scripts
Shell Scripts are very useful but not all that fun to look at. They have simple user input and output text. But, there is a way to spice up your scripts and make them a bit more eye catching with a simple program called "Figlet".
Figlet is in the repositories for most distributions of Linux and is very simple to use. If you've used the "echo" command (which you probably have) you already know how to use the basic functionality of Figlet. Here's an example of "echo" and "Figlet" next to each other:
You can see that Figlet's ASCII art style output will catch someone's attention more then the regular echo output would.
You can display the content of a file using Figlet like this:
If you would like to display the output of a command using Figlet simply pipe the command into Figlet:
Figlet comes with a few different font styles. To see a list of available fonts use the "figlist" command. To choose a font use the "-f" switch:
Here is a little script I wrote to display what each font looks like.
#!/bin/bash figlist | while read font do figlet -f $font "$font" done
If you would like to have a nice looking clock in your terminal window you can use this script
#!/bin/bash while [ 1 ]; do clear date +%r | figlet sleep 1 done
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- SUSE – “Will not diverge from its Open Source roots!”
- Dealing with Boundary Issues
- Vagrant Simplified
- Libreboot on an X60, Part I: the Setup
- System Status as SMS Text Messages
- Bluetooth Hacks
- October 2015 Issue of Linux Journal: Raspberry Pi
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- New Products
- October 2015 Video Preview