From f6dc72ca1d50a46fc5df08ba0b27e48c4ecc9f75 Mon Sep 17 00:00:00 2001 From: szaimen Date: Wed, 4 Nov 2020 21:19:21 +0100 Subject: [PATCH] fix a bug in midnight-commander.sh (#1653) --- apps/midnight-commander.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/apps/midnight-commander.sh b/apps/midnight-commander.sh index 2f0893e8..edffe529 100644 --- a/apps/midnight-commander.sh +++ b/apps/midnight-commander.sh @@ -52,13 +52,22 @@ fi # Install dark theme print_text_in_color "$ICyan" "Installing dark theme for Midnight Commander..." -USER_HOMES=$(find /home -mindepth 1 -maxdepth 1 -type d) -mapfile -t USER_HOMES <<< "$USER_HOMES" -USER_HOMES+=(/root) -for user_home in "${USER_HOMES[@]}" +if [ -z "$UNIXUSER" ] +then + USERS=(root) +else + USERS=("$UNIXUSER" root) +fi +for user in "${USERS[@]}" do - mkdir -p "$user_home/.config/mc" - cat << MC_INI > "$user_home/.config/mc/ini" + if [ "$user" = root ] + then + MC_PATH=/root/.config/mc + else + MC_PATH=/home/$user/.config/mc + fi + sudo -u "$user" mkdir -p "$MC_PATH" + sudo -u "$user" cat << MC_INI > "$MC_PATH/ini" [Colors] base_color=linux:normal=white,black:marked=yellow,black:input=,green:menu=black:menusel=white:\ menuhot=red,:menuhotsel=black,red:dfocus=white,black:dhotnormal=white,black:\