fix: fix can't run it as expected in freebsd (#5595)

In freebsd, su -c expects a login class argument instead of a command, if -c is preceded by a username, then -c and the arguments that follow will be passed as shell arguments
This commit is contained in:
unknowndevQwQ 2022-09-29 05:06:24 +08:00 committed by GitHub
parent acdbefb986
commit b6aeb4bfab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -556,7 +556,7 @@ sudo_sh_c() {
elif command_exists sudo; then
sh_c "sudo $*"
elif command_exists su; then
sh_c "su - -c '$*'"
sh_c "su root -c '$*'"
else
echoh
echoerr "This script needs to run the following command as root."