Skip to content

Instantly share code, notes, and snippets.

@mattjj
Created January 1, 2013 18:18
Show Gist options
  • Save mattjj/4429108 to your computer and use it in GitHub Desktop.
Save mattjj/4429108 to your computer and use it in GitHub Desktop.
simple shell cachefile convenience function
#!/bin/bash
usage() { echo "usage: ${0##*/} commandstring cachefilename"; }
if [ $# -ne 2 ]; then usage; exit 0; fi
if [ -e "$2" ]
then
cat "$2"
else
eval "$1" | tee $2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment