Last active
October 15, 2020 11:15
-
-
Save zu1k/f09833c5b74f3c8b35078805d1164ffd to your computer and use it in GitHub Desktop.
run-shell-with-sudo.sh
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
#!/usr/bin/env bash | |
if [[ $EUID -ne 0 ]]; then | |
if sudo -v ; then | |
sudo $0 | |
else | |
echo "请使用root权限运行脚本" | |
fi | |
else | |
# your shell | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment