Skip to content

Instantly share code, notes, and snippets.

Calculate the phase of the moon in bash and get the appropriate icon. This can be used to put a picture of the phase of the moon in your bash prompt.

I used the "Simple" lunar phase calculator from here:

http://www.ben-daglish.net/moon.shtml

It seems to work well on OSX. The call to date that I use is not portable to linux or solaris since date is one of the most infuriatingly inconsistent utilities.