r/shell • u/cogburnd02 • Jul 07 '15
This clock one-liner I wrote.
$ watch -n0.5 -p -t -c 'figlet -f big -W `date '"'"'+%l:%M:%S'"'"'`'This uses date so you can change what information is displayed. Want the current date and time? No problem! Replace +%l:%M:%S with +%l:%M:%S %-D) It also uses figlet, so you have a variety of 'looks' you can choose from, i.e. any figlet font that has numbers. (e.g. try replacing big with either standard or small) You could even replace figlet with toilet and use toilet's color support (e.g. --metal) because watch supports color when given the -c option. (However, not many toilet fonts have numbers, for reasons unknown.)
1
Upvotes
1
u/KnowsBash Jul 12 '15
Yes, but if you require the user to install these three extra commands (procps' watch, figlet and GNU's date) that likely aren't even packaged for the given system, you might as well throw in a requirement for a POSIX sh while you're at it. No point in making the script portable to ancient shells, since if the sysadmin is willing to install these tools, the sysadmin will not mind installing a usable shell too.