Hacker News new | ask | show | jobs
by chch 4805 days ago
Instead of using a very long set of If statements, I think you could just use something like

    a=$((`date +%M`/15));b=$((128335 + `date +%l` +((a*(a**2-39*a+110))/6)));printf '%x' $b;
and print the resulting hex's character, no?

(I'd finish off the code myself, but I have a bus to catch)

Edit: Ah, I see Sephr came prepared. ;)

2 comments

I've proposed a PR that do just that (maybe a little bit more readable): https://github.com/paulsm/bashtime/pull/1

Also, the code is now used in the liquid prompt: https://github.com/nojhan/liquidprompt/commit/91959b636af751...

I'm sure you could. It's a quick hack.
No criticism here; your quick hack let me do a quick hack and learn some bash in the process. :)