zmini-fortune

Lars Wirzenius wrote a mini-fortune in Python.

Here is a Z-Shell version.

#!/bin/zsh
zmodload zsh/mapfile
y=(${(ps:%%\n:)"${mapfile[$1]}"})
integer z=$#y
print -n $y[RANDOM%z+1]

Obviously you could make it shorter with a bit of effort.

Posted on 2005-07-01
Tags: