Reputation: 15294
I tried to fake a sudo program that requires real superuser password:
#!/bin/sh
su -c "'$*'"
It works when I do
sudo yum
But does not work when I do
sudo yum upgrade
Or any command that has arguments. Bash complains
bash: yum upgrade command not found
Why is this happening?
Upvotes: 0
Views: 881
Reputation: 212464
You're quoting incorrectly. This is the rare case where you actually want "$*"
instead of "$@"
. But you definitely do not want "'$*'"
Upvotes: 2