Skip to content

Instantly share code, notes, and snippets.

@joshuaspence
Created August 7, 2020 03:08
Show Gist options
  • Save joshuaspence/03219cf63ce5395d2e0c00a54b969007 to your computer and use it in GitHub Desktop.
Save joshuaspence/03219cf63ce5395d2e0c00a54b969007 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -o errexit
set -o nounset
set -o pipefail
readonly SCRIPT_DIR="${HOME}/workspace/personal/pocketsmith_backup"
readonly OUTPUT_DIR="${HOME}/Desktop/budget"
readonly BACKUP_DIR="${OUTPUT_DIR}.bak"
cp --recursive "${OUTPUT_DIR}" "${BACKUP_DIR}"
$SCRIPT_DIR/categories.sh > $OUTPUT_DIR/categories-all.txt
$SCRIPT_DIR/budgets.sh > $OUTPUT_DIR/categories-budgeted.txt
comm -23 $OUTPUT_DIR/categories-all.txt <(cat $OUTPUT_DIR/categories-{budgeted,parent,todo}.txt | sort) > $OUTPUT_DIR/categories-unbudgeted.txt
diff --unified --recursive "${BACKUP_DIR}" "${OUTPUT_DIR}" || true
rm --recursive --force "${BACKUP_DIR}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment