diff --git a/.update.sh b/.update.sh index ac220ef..f0b3ad9 100755 --- a/.update.sh +++ b/.update.sh @@ -20,7 +20,7 @@ export DEBIAN_FRONTEND=noninteractive ADJUSTED_ID="None" -NON_ROOT_USER=$(logname 2>/dev/null || echo "nobody") +NON_ROOT_USER=$(id -un 2>/dev/null || echo "nobody") ################################################################################################### # Functions @@ -236,7 +236,7 @@ update_brew() { # Safely drop privileges back to the normal user to run brew commands if [ "${NON_ROOT_USER}" != "nobody" ] && [ "${NON_ROOT_USER}" != "root" ]; then - if ! su - "${NON_ROOT_USER}" -s /bin/sh -c "${_brew_cmds}"; then + if ! su - "${NON_ROOT_USER}" -c "${_brew_cmds}"; then print_err "Error: Brew commands failed for user ${NON_ROOT_USER}." return fi