madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

initial checkin
[etc/quotes.git] / .bin / get_quote
1 #!/bin/sh
2 #
3 # output a random quote from my quotes database
4 #
5 # Copyright © 1997–2008 martin f. krafft <madduck@madduck.net>
6 # Released under the terms of the Artistic Licence 2.0
7 #
8 set -eu
9
10 if [ ! -x "$(command -v fortune)" ]; then
11   echo "E: fortune not installed" >&2
12   echo "This space unintentionally left blank"
13   exit 1
14 fi
15
16 QUOTES_FILE=${0%/*}/../.quotes/quotes
17 QUOTES_HASH=${QUOTES_FILE}.dat
18
19 if [ ! -f "$QUOTES_HASH" ] || [ "$QUOTES_HASH" -ot "$QUOTES_FILE" ]; then
20   echo I: rebuilding quotes hash... >&2
21   strfile -s "$QUOTES_FILE"
22 fi
23
24 args=
25 [ -n "${1:-}" ] && args="-i -m $@"
26
27 eval exec fortune $args $QUOTES_FILE 2>/dev/null