Uniquely (sort of) color text so you can see changes

function colorify() { n=$(bc <<< "$(echo ${1}|od -An -vtu1 -w100000000|tr -d ' ') % 7"); echo -e "\e[3${n}m${1}\e[0m"; }
Colorify colors input by converting the text to a number and then performing modulo 7 on it. This resulting number is used as the color escape code. This can be used to color the results of commands with complex outputs (like "482279054165371") so if any of the digits change, there's a good chance the color will change too. I say good chance because there's only 7 unique colors here, so assuming you were watching random numbers, there would be a 6/7 chance that the color would change when the number changed. This should really only be used to help quickly identify when things change, but should not be the only thing relied upon to positively assert that an output has not changed.
Sample Output
$ colorify test
test (shows as orange)
$ colorify test2
test2 (shows as purple)

0
By: tyzbit
2020-08-06 15:17:45

What Others Think

The content of your article page is very good, I find the content quite good and helpful to me, thank you for UnlockMyTV
UnlockMyTvApk · 5 weeks and 3 days ago
This is actually the kind of information I have been trying to find. Thank you for writing this information. Road Trip Planning
Cameliagobella · 5 weeks and 2 days ago
Color text is a unique and different way to write code on word. This gives a different look and also helps to distinguish between the two codes. The https://honestessaywriter.com/dissertation-help/ is an online writing service for college students.
Corban8 · 5 weeks and 1 day ago
I always get useful information through this site. I am a computer science and engineering graduate. But still, I am not good at coding. Through your site, I found coding easy. Hemp Oil So I use your help to learn to code well.
MariyaDorothy · 3 weeks and 2 days ago
family visa UK .. immigration lawyer dublin
saeed20 · 2 weeks and 5 days ago
You cannot be weak on the path of your dream. Dare to overcome the barriers to find your own way. shell shockers
JoEmily · 2 weeks and 2 days ago
You shouldn't waste time on registration and communication in the service for easy russians brides flirting if your goal is marriage. This rule is self-explanatory. However, how to choose the one that suits serious intentions in the variety of services? I advise you to read reviews on the Internet - this is usually enough. It is also very important how the service itself positions itself. For example, if its main page contains photos of hot beauties or brutal macho and promises of easy, easy communication, this is not an option for serious acquaintances.
ArdellaPolinski · 2 weeks and 2 days ago
The Get-Unique cmdlet compares each item in a sorted list to the next item, eliminates duplicates, and returns only one instance of each item. Hardwood Floor Refinishing St Louis MO
emilygoutagny · 2 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: