mirror of
https://github.com/xykt/NetQuality.git
synced 2026-01-12 20:15:34 +08:00
Incorrect sudo permission judgment logic
Reason: command -v sudo only determines whether the command exists, not whether sudo is available.
This commit is contained in:
@@ -24,7 +24,7 @@ upgrade_bash() {
|
||||
else
|
||||
if [ -f /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
if [ $(id -u) -ne 0 ] && ! command -v sudo >/dev/null 2>&1; then
|
||||
if [ $(id -u) -ne 0 ] && ! sudo -v >/dev/null 2>&1; then
|
||||
echo "Error: You need sudo privileges to upgrade Bash."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user