Skip to content

Instantly share code, notes, and snippets.

@LeastFixedPoint
Last active December 18, 2015 10:19
Show Gist options
  • Save LeastFixedPoint/5767764 to your computer and use it in GitHub Desktop.
Save LeastFixedPoint/5767764 to your computer and use it in GitHub Desktop.
function spy() {
PID=`[ $# == 0 ] && jobs -p | tail -1 || echo $$`
touch /tmp/spy.$PID
[ $# -eq 0 ] && fg || "${@}"
rm /tmp/spy.$PID
}
Usage:
$ spy long-running-operation
or
$ long-running-operation
^Z
$ spy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment