backup.sh 391 B

12345678910111213141516
  1. #!/usr/bin/zsh
  2. # determine start and end years
  3. startyear=$1
  4. endyear=$2
  5. cd ${LEDGER_DIRECTORY}
  6. cp ${LEDGER_FILE_NAME} ${LEDGER_FILE_NAME}.bak
  7. ledger -b ${startyear} -e ${endyear} print > ${LEDGER_FILE_NAME}-${startyear}.dat
  8. ledger equity assets > equity.tmp
  9. ledger -b ${endyear} print > ledger.tmp
  10. cat template.dat equity.tmp ledger.tmp > ${LEDGER_FILE_NAME}
  11. rm -r equity.tmp ledger.tmp