From ed173d9c9aac7b0e9b2ffeb782b42ef6663cc58e Mon Sep 17 00:00:00 2001 From: Dev & Sec Date: Tue, 3 Nov 2015 22:22:49 +0000 Subject: [PATCH] fix sh compatibility --- letsencrypt-auto | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/letsencrypt-auto b/letsencrypt-auto index 514f03f46..cfc830c9f 100755 --- a/letsencrypt-auto +++ b/letsencrypt-auto @@ -15,12 +15,13 @@ VENV_BIN=${VENV_PATH}/bin if test "`id -u`" -ne "0" ; then if ! type sudo &>/dev/null; then - function sudo (){ - args=("$@") - for i in "${!args[@]}"; do - args[$i]="'$(printf "%s" "${args[$i]}" | sed -e "s/'/'\"'\"'/g")' " + sudo() { + args="" + while [ $# -ne 0 ]; do + args="$args'$(printf "%s" "$1" | sed -e "s/'/'\"'\"'/g")' " + shift done - su root -c "${args[*]}" + su root -c "$args" } fi SUDO=sudo