function get_temp_name { temp_dir=$(mktemp -u -d -t $1-XXXXXXXX) } function error { echo $* > /dev/stderr false } function file_exists { [[ -f $1 ]] || error "file $1 doesn't exist" } function dir_exists { [[ -d $1 ]] || error "directory $1 doesn't exist" }