#!/bin/sh args_chk=`echo "$@" | md5 -q` cache_dir=$HOME/.dcache [ ! -d "$cache_dir" ] && mkdir $cache_dir cache_file="$cache_dir/$args_chk" if [ -f "$cache_file" ] ; then echo "Using cache..." >&2 cpio --absolute-filenames --quiet -d -i < $cache_file else echo "Running original..." >&2 output=/tmp/dcache.$$ truss -o $output -Sfa "$@" egrep 'open\("[^"]+",.*O_(WRONLY|APPEND|CREAT|TRUNC).*,' $output \ | awk -F\" '{printf("%s\0", $2)}' \ | cpio --quiet -o0H ustar > $cache_file rm $output fi