-
-
Save maz-1/557d438f46803409968c593658d25c66 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
stampfile=/tmp/sudo.${USER}.stamp | |
if [[ -t 1 ]] | |
then | |
if (test -f ${stampfile} && test `find "${stampfile}" -mmin +180`) || [ ! -f ${stampfile} ] | |
then | |
read -p "Are you sure to invoke this command in administrator mode? [Y/n] " answer | |
case $(echo $answer | tr [:upper:] [:lower:]) in | |
n|no) | |
return | |
;; | |
*) | |
touch ${stampfile} | |
exec /usr/bin/sudo "$@" | |
;; | |
esac | |
else | |
exec /usr/bin/sudo "$@" | |
fi | |
else | |
exec /usr/bin/sudo "$@" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment