fix sudo function name scope issue, it is not a local function

This commit is contained in:
Dev & Sec
2015-11-03 22:34:07 +00:00
parent ed173d9c9a
commit 5c8ad3666b
+5 -3
View File
@@ -14,8 +14,10 @@ VENV_PATH=${VENV_PATH:-"$XDG_DATA_HOME/$VENV_NAME"}
VENV_BIN=${VENV_PATH}/bin
if test "`id -u`" -ne "0" ; then
if ! type sudo &>/dev/null; then
sudo() {
if type sudo &>/dev/null; then
SUDO=sudo
else
su_sudo() {
args=""
while [ $# -ne 0 ]; do
args="$args'$(printf "%s" "$1" | sed -e "s/'/'\"'\"'/g")' "
@@ -23,8 +25,8 @@ if test "`id -u`" -ne "0" ; then
done
su root -c "$args"
}
SUDO=su_sudo
fi
SUDO=sudo
else
SUDO=
fi