Skip to content

Instantly share code, notes, and snippets.

@aphex3k
Created April 4, 2016 21:33
Show Gist options
  • Select an option

  • Save aphex3k/1cfc32b88fd05ba39c77e4a92408732f to your computer and use it in GitHub Desktop.

Select an option

Save aphex3k/1cfc32b88fd05ba39c77e4a92408732f to your computer and use it in GitHub Desktop.
Backup current installed cask list to gist
#!/bin/sh
gistId=8fe981c9d3696fe97955ebea7cc3e0f2
gistOld=/tmp/gist-restore.old
gistCurrent=/tmp/gist-restore.current
if [ -f "${gistOld}" ]
then
rm "${gistOld}"
fi
if [ -f "${gistCurrent}" ]
then
rm "${gistCurrent}"
fi
gist -r ${gistId} > /tmp/gist-restore.old
brew cask list > /tmp/gist-restore.current
diff -w -B -a -q /tmp/gist-restore.old /tmp/gist-restore.current >/dev/null
if [ ! "0$?" -eq "00" ]
then
gist -u "${gistId}" "${gistCurrent}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment