fix: EUID is a readonly variable on some shells (#379)

This commit is contained in:
UUBulb 2024-06-25 23:00:30 +08:00 committed by GitHub
parent 61127b3435
commit 61e16f96c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -24,8 +24,8 @@ os_arch=""
[ -e /etc/os-release ] && grep -i "PRETTY_NAME" /etc/os-release | grep -qi "alpine" && os_alpine='1'
sudo() {
EUID=$(id -ru)
if [ "$EUID" -ne 0 ]; then
myEUID=$(id -ru)
if [ "$myEUID" -ne 0 ]; then
if command -v sudo > /dev/null 2>&1; then
command sudo "$@"
else

View File

@ -24,8 +24,8 @@ os_arch=""
[ -e /etc/os-release ] && grep -i "PRETTY_NAME" /etc/os-release | grep -qi "alpine" && os_alpine='1'
sudo() {
EUID=$(id -ru)
if [ "$EUID" -ne 0 ]; then
myEUID=$(id -ru)
if [ "$myEUID" -ne 0 ]; then
if command -v sudo > /dev/null 2>&1; then
command sudo "$@"
else