Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danijeljw/f1b7edd1ed5a00dc70dd79e07244e682 to your computer and use it in GitHub Desktop.
Save danijeljw/f1b7edd1ed5a00dc70dd79e07244e682 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Kick off with sudo request
sudo -v
# Keep-alive: update existing sudo time stamp if set, otherwise do nothing.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Kill sudo when done, no password required:
sudo -k
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment