From d0b76012df77c217ce7c518e76e59b4f9935a400 Mon Sep 17 00:00:00 2001 From: Chris Titus Date: Thu, 19 Sep 2024 13:05:36 -0500 Subject: [PATCH] Fixes all BASHISMS --- tabs/applications-setup/browser-setup.sh | 4 +-- tabs/applications-setup/dwmtitus-setup.sh | 6 ++-- tabs/applications-setup/mybash-setup.sh | 2 +- tabs/applications-setup/neovim-setup.sh | 2 +- tabs/applications-setup/setup-flatpak.sh | 22 ++++++------ tabs/system-setup/5-samba-ssh-setup.sh | 26 +++++++------- tabs/system-setup/6-docker-setup.sh | 24 ++++++------- tabs/system-setup/9-auto-mount.sh | 10 +++--- tabs/system-setup/arch/paru-setup.sh | 6 ++-- tabs/system-setup/arch/yay-setup.sh | 6 ++-- tabs/system-setup/fedora/configure-dnf.sh | 10 +++--- tabs/system-setup/fedora/multimedia-codecs.sh | 8 ++--- .../fedora/nvidia-proprietary-driver-setup.sh | 6 ++-- tabs/system-setup/fedora/virtualization.sh | 4 +-- tabs/system-setup/system-cleanup.sh | 2 +- tabs/system-setup/system-update.sh | 4 +-- tabs/utils/auto-login.sh | 34 +++++++++---------- tabs/utils/create-bootable-usb.sh | 10 +++--- tabs/utils/encrypt_decrypt_tool.sh | 10 +++--- tabs/utils/power-profile.sh | 16 ++++----- tabs/utils/service-control.sh | 30 ++++++++-------- tabs/utils/ssh.sh | 20 +++++------ tabs/utils/timeshift.sh | 24 ++++++------- .../user-account-manager/add_to_group.sh | 3 +- tabs/utils/user-account-manager/add_user.sh | 2 +- .../user-account-manager/change_password.sh | 2 +- .../user-account-manager/remove_from_group.sh | 3 +- 27 files changed, 149 insertions(+), 147 deletions(-) diff --git a/tabs/applications-setup/browser-setup.sh b/tabs/applications-setup/browser-setup.sh index 87970ca09..3e7f5e20e 100644 --- a/tabs/applications-setup/browser-setup.sh +++ b/tabs/applications-setup/browser-setup.sh @@ -31,7 +31,7 @@ install_chrome() { install_thorium() { printf "%b\n" "${YELLOW}Installing Thorium Browser...${RC}" - case $PACKAGER in + case "$PACKAGER" in apt-get|nala) "$ESCALATION_TOOL" rm -fv /etc/apt/sources.list.d/thorium.list "$ESCALATION_TOOL" wget --no-hsts -P /etc/apt/sources.list.d/ http://dl.thorium.rocks/debian/dists/stable/thorium.list @@ -79,7 +79,7 @@ install_firefox() { install_librewolf() { printf "%b\n" "${YELLOW}Installing Librewolf...${RC}" - case $PACKAGER in + case "$PACKAGER" in apt-get|nala) "$ESCALATION_TOOL" "$PACKAGER" update && "$ESCALATION_TOOL" "$PACKAGER" install -y wget gnupg lsb-release apt-transport-https ca-certificates distro=`if echo " una bookworm vanessa focal jammy bullseye vera uma " | grep -q " $(lsb_release -sc) "; then lsb_release -sc; else echo focal; fi` diff --git a/tabs/applications-setup/dwmtitus-setup.sh b/tabs/applications-setup/dwmtitus-setup.sh index 598a0c63e..1632dd8f9 100755 --- a/tabs/applications-setup/dwmtitus-setup.sh +++ b/tabs/applications-setup/dwmtitus-setup.sh @@ -16,7 +16,7 @@ setupDWM() { "$ESCALATION_TOOL" "$PACKAGER" install -y libX11-devel libXinerama-devel libXft-devel imlib2-devel libxcb-devel ;; *) - printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" exit 1 ;; esac @@ -188,7 +188,7 @@ setupDisplayManager() { "$ESCALATION_TOOL" "$PACKAGER" install -y xorg-x11-xinit xorg-x11-server-Xorg ;; *) - printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" exit 1 ;; esac @@ -216,7 +216,7 @@ setupDisplayManager() { "$ESCALATION_TOOL" "$PACKAGER" install -y "$DM" ;; *) - printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" exit 1 ;; esac diff --git a/tabs/applications-setup/mybash-setup.sh b/tabs/applications-setup/mybash-setup.sh index 04772cf7f..d1facbb39 100644 --- a/tabs/applications-setup/mybash-setup.sh +++ b/tabs/applications-setup/mybash-setup.sh @@ -20,7 +20,7 @@ installDepend() { "$ESCALATION_TOOL" "$PACKAGER" install -y bash bash-completion tar bat tree unzip fontconfig git ;; *) - printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" # The packages above were grabbed out of the original mybash-setup-script. + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" # The packages above were grabbed out of the original mybash-setup-script. exit 1 ;; esac diff --git a/tabs/applications-setup/neovim-setup.sh b/tabs/applications-setup/neovim-setup.sh index 040587736..8bb451742 100755 --- a/tabs/applications-setup/neovim-setup.sh +++ b/tabs/applications-setup/neovim-setup.sh @@ -29,7 +29,7 @@ installNeovim() { "$ESCALATION_TOOL" "$PACKAGER" install -y neovim ripgrep fzf python3-virtualenv luarocks golang ShellCheck git ;; *) - printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" # The packages above were grabbed out of the original nvim-setup-script. + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" # The packages above were grabbed out of the original nvim-setup-script. exit 1 ;; esac diff --git a/tabs/applications-setup/setup-flatpak.sh b/tabs/applications-setup/setup-flatpak.sh index 749ddf1ba..5a1cf60f0 100644 --- a/tabs/applications-setup/setup-flatpak.sh +++ b/tabs/applications-setup/setup-flatpak.sh @@ -23,30 +23,30 @@ setup_flatpak() { printf "%b\n" "${YELLOW}Installing Flatpak...${RC}" case "$PACKAGER" in pacman) - $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm flatpak + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm flatpak ;; apt-get|nala) - $ESCALATION_TOOL "$PACKAGER" install -y flatpak + "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak ;; dnf) - $ESCALATION_TOOL "$PACKAGER" install -y flatpak # Fedora should have flatpak already installed, this is just a failsafe + "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak # Fedora should have flatpak already installed, this is just a failsafe ;; zypper) - $ESCALATION_TOOL "$PACKAGER" install -y flatpak + "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak ;; yum) - $ESCALATION_TOOL "$PACKAGER" install -y flatpak + "$ESCALATION_TOOL" "$PACKAGER" install -y flatpak ;; xbps-install) - $ESCALATION_TOOL "$PACKAGER" install -S flatpak + "$ESCALATION_TOOL" "$PACKAGER" install -S flatpak ;; *) - printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" exit 1 ;; esac printf "%b\n" "Adding Flathub remote..." - $ESCALATION_TOOL flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo else if command -v flatpak >/dev/null 2>&1; then if ! flatpak remotes | grep -q "flathub"; then @@ -55,7 +55,7 @@ setup_flatpak() { case "$add_remote" in [Yy]*) printf "%b\n" "Adding Flathub remote..." - $ESCALATION_TOOL flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo + "$ESCALATION_TOOL" flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo ;; esac else @@ -73,14 +73,14 @@ setup_flatpak() { printf "%b\n" "${YELLOW}Detected GNOME desktop environment. Would you like to install GNOME Software plugin for Flatpak? (y/n)${RC}" read install_gnome if [ "$install_gnome" = "y" ] || [ "$install_gnome" = "Y" ]; then - $ESCALATION_TOOL "$PACKAGER" install -y gnome-software-plugin-flatpak + "$ESCALATION_TOOL" "$PACKAGER" install -y gnome-software-plugin-flatpak fi # Useful for Debian KDE spin as well elif [ "$DE" = "KDE" ]; then printf "%b\n" "${YELLOW}Detected KDE desktop environment. Would you like to install KDE Plasma Discover backend for Flatpak? (y/n)${RC}" read install_kde if [ "$install_kde" = "y" ] || [ "$install_kde" = "Y" ]; then - $ESCALATION_TOOL "$PACKAGER" install -y plasma-discover-backend-flatpak + "$ESCALATION_TOOL" "$PACKAGER" install -y plasma-discover-backend-flatpak fi fi fi diff --git a/tabs/system-setup/5-samba-ssh-setup.sh b/tabs/system-setup/5-samba-ssh-setup.sh index 7e22f2624..b130b290a 100755 --- a/tabs/system-setup/5-samba-ssh-setup.sh +++ b/tabs/system-setup/5-samba-ssh-setup.sh @@ -9,10 +9,10 @@ install_package() { if ! command_exists "$PACKAGE"; then case "$PACKAGER" in pacman) - $ESCALATION_TOOL "$PACKAGER" -S --noconfirm "$PACKAGE" + "$ESCALATION_TOOL" "$PACKAGER" -S --noconfirm "$PACKAGE" ;; *) - $ESCALATION_TOOL "$PACKAGER" install -y "$PACKAGE" + "$ESCALATION_TOOL" "$PACKAGER" install -y "$PACKAGE" ;; esac else @@ -41,8 +41,8 @@ setup_ssh() { esac # Enable and start the appropriate SSH service - $ESCALATION_TOOL systemctl enable "$SSH_SERVICE" - $ESCALATION_TOOL systemctl start "$SSH_SERVICE" + "$ESCALATION_TOOL" systemctl enable "$SSH_SERVICE" + "$ESCALATION_TOOL" systemctl start "$SSH_SERVICE" # Get the local IP address LOCAL_IP=$(ip -4 addr show | awk '/inet / {print $2}' | tail -n 1) @@ -82,8 +82,8 @@ setup_samba() { SHARED_DIR=${SHARED_DIR:-/srv/samba/share} # Create the shared directory if it doesn't exist - $ESCALATION_TOOL mkdir -p "$SHARED_DIR" - $ESCALATION_TOOL chmod -R 0777 "$SHARED_DIR" + "$ESCALATION_TOOL" mkdir -p "$SHARED_DIR" + "$ESCALATION_TOOL" chmod -R 0777 "$SHARED_DIR" # Add a new Samba user printf "Enter Samba username: " @@ -109,10 +109,10 @@ setup_samba() { done # Add the user and set the password - $ESCALATION_TOOL smbpasswd -a "$SAMBA_USER" + "$ESCALATION_TOOL" smbpasswd -a "$SAMBA_USER" # Configure Samba settings - $ESCALATION_TOOL sh -c "cat > $SAMBA_CONFIG" < $SAMBA_CONFIG" < /dev/null - printf "%b\n" "$fstab_entry" | $ESCALATION_TOOL tee -a /etc/fstab > /dev/null + printf "%b\n" "$comment" | "$ESCALATION_TOOL" tee -a /etc/fstab > /dev/null + printf "%b\n" "$fstab_entry" | "$ESCALATION_TOOL" tee -a /etc/fstab > /dev/null printf "%b\n" "" | "$ESCALATION_TOOL" tee -a /etc/fstab > /dev/null printf "%b\n" "Entry added to /etc/fstab:" @@ -71,7 +71,7 @@ update_fstab() { # Function to mount the drive mount_drive() { printf "%b\n" "Mounting the drive..." - $ESCALATION_TOOL mount -a + "$ESCALATION_TOOL" mount -a if mount | grep "$mount_point" > /dev/null; then printf "%b\n" "${GREEN}Drive mounted successfully at $mount_point${RC}." else diff --git a/tabs/system-setup/arch/paru-setup.sh b/tabs/system-setup/arch/paru-setup.sh index 05b78c80c..d383764fd 100755 --- a/tabs/system-setup/arch/paru-setup.sh +++ b/tabs/system-setup/arch/paru-setup.sh @@ -7,8 +7,8 @@ installDepend() { pacman) if ! command_exists paru; then printf "%b\n" "${YELLOW}Installing paru as AUR helper...${RC}" - $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel - cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/paru.git && $ESCALATION_TOOL chown -R "$USER": ./paru + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel + cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/paru.git && "$ESCALATION_TOOL" chown -R "$USER": ./paru cd paru && makepkg --noconfirm -si printf "%b\n" "${GREEN}Paru installed${RC}" else @@ -16,7 +16,7 @@ installDepend() { fi ;; *) - printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" ;; esac } diff --git a/tabs/system-setup/arch/yay-setup.sh b/tabs/system-setup/arch/yay-setup.sh index f7f9fa6aa..398f87003 100755 --- a/tabs/system-setup/arch/yay-setup.sh +++ b/tabs/system-setup/arch/yay-setup.sh @@ -7,8 +7,8 @@ installDepend() { pacman) if ! command_exists yay; then printf "%b\n" "${YELLOW}Installing yay as AUR helper...${RC}" - $ESCALATION_TOOL "$PACKAGER" -S --needed --noconfirm base-devel - cd /opt && $ESCALATION_TOOL git clone https://aur.archlinux.org/yay-bin.git && $ESCALATION_TOOL chown -R "$USER": ./yay-bin + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm base-devel + cd /opt && "$ESCALATION_TOOL" git clone https://aur.archlinux.org/yay-bin.git && "$ESCALATION_TOOL" chown -R "$USER": ./yay-bin cd yay-bin && makepkg --noconfirm -si printf "%b\n" "${GREEN}Yay installed${RC}" else @@ -16,7 +16,7 @@ installDepend() { fi ;; *) - printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" ;; esac } diff --git a/tabs/system-setup/fedora/configure-dnf.sh b/tabs/system-setup/fedora/configure-dnf.sh index 2d043da27..b51c8b4cc 100644 --- a/tabs/system-setup/fedora/configure-dnf.sh +++ b/tabs/system-setup/fedora/configure-dnf.sh @@ -3,13 +3,13 @@ . ../../common-script.sh configureDNF() { - case $PACKAGER in + case "$PACKAGER" in dnf) printf "%b\n" "${YELLOW}Configuring DNF...${RC}" - $ESCALATION_TOOL sed -i '/^max_parallel_downloads=/c\max_parallel_downloads=10' /etc/dnf/dnf.conf || echo 'max_parallel_downloads=10' >> /etc/dnf/dnf.conf - echo "fastestmirror=True" | $ESCALATION_TOOL tee -a /etc/dnf/dnf.conf > /dev/null - echo "defaultyes=True" | $ESCALATION_TOOL tee -a /etc/dnf/dnf.conf > /dev/null - $ESCALATION_TOOL "$PACKAGER" -y install dnf-plugins-core + "$ESCALATION_TOOL" sed -i '/^max_parallel_downloads=/c\max_parallel_downloads=10' /etc/dnf/dnf.conf || echo 'max_parallel_downloads=10' >> /etc/dnf/dnf.conf + echo "fastestmirror=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null + echo "defaultyes=True" | "$ESCALATION_TOOL" tee -a /etc/dnf/dnf.conf > /dev/null + "$ESCALATION_TOOL" "$PACKAGER" -y install dnf-plugins-core printf "%b\n" "${GREEN}DNF Configured Succesfully...${RC}" ;; *) diff --git a/tabs/system-setup/fedora/multimedia-codecs.sh b/tabs/system-setup/fedora/multimedia-codecs.sh index a5db96a79..751e4547b 100644 --- a/tabs/system-setup/fedora/multimedia-codecs.sh +++ b/tabs/system-setup/fedora/multimedia-codecs.sh @@ -3,13 +3,13 @@ . ../../common-script.sh multimedia() { - case $PACKAGER in + case "$PACKAGER" in dnf) if [ -e /etc/yum.repos.d/rpmfusion-free.repo ] && [ -e /etc/yum.repos.d/rpmfusion-nonfree.repo ]; then printf "%b\n" "${YELLOW}Installing Multimedia Codecs...${RC}" - $ESCALATION_TOOL "$PACKAGER" swap ffmpeg-free ffmpeg --allowerasing -y - $ESCALATION_TOOL "$PACKAGER" update @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin -y - $ESCALATION_TOOL "$PACKAGER" update @sound-and-video -y + "$ESCALATION_TOOL" "$PACKAGER" swap ffmpeg-free ffmpeg --allowerasing -y + "$ESCALATION_TOOL" "$PACKAGER" update @multimedia --setopt="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin -y + "$ESCALATION_TOOL" "$PACKAGER" update @sound-and-video -y printf "%b\n" "${GREEN}Multimedia Codecs Installed...${RC}" else printf "%b\n" "${RED}RPM Fusion repositories not found. Please set up RPM Fusion first!${RC}" diff --git a/tabs/system-setup/fedora/nvidia-proprietary-driver-setup.sh b/tabs/system-setup/fedora/nvidia-proprietary-driver-setup.sh index 6f99eb6c3..7abfba7ca 100755 --- a/tabs/system-setup/fedora/nvidia-proprietary-driver-setup.sh +++ b/tabs/system-setup/fedora/nvidia-proprietary-driver-setup.sh @@ -18,10 +18,10 @@ checkRepo() { printf "%b\n" "${YELLOW}Nvidia non-free repository is not enabled. Enabling now...${RC}" # Enable the repository - $ESCALATION_TOOL dnf config-manager --set-enabled "$REPO_ID" + "$ESCALATION_TOOL" dnf config-manager --set-enabled "$REPO_ID" # Refreshing repository list - $ESCALATION_TOOL dnf makecache + "$ESCALATION_TOOL" dnf makecache # Verify if the repository is enabled if [ $(dnf repolist enabled 2>/dev/null | grep "$REPO_ID" | wc -l) -gt 0 ]; then @@ -49,7 +49,7 @@ installDriver() { fi # NOTE:: Installing graphics driver. - $ESCALATION_TOOL dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y + "$ESCALATION_TOOL" dnf install akmod-nvidia xorg-x11-drv-nvidia-cuda -y printf "%b\n" "${YELLOW}Building the drivers may take upto 5 minutes. Please don't kill the script!\n If the build failed try running the script again, select \"Remove Nvidia Drivers\" and reboot the system, then try installing drivers again.${RC}" for i in $(seq 1 5); do diff --git a/tabs/system-setup/fedora/virtualization.sh b/tabs/system-setup/fedora/virtualization.sh index 35a72b7d0..626c2e43e 100644 --- a/tabs/system-setup/fedora/virtualization.sh +++ b/tabs/system-setup/fedora/virtualization.sh @@ -4,10 +4,10 @@ # Install virtualization tools to enable virtual machines configureVirtualization() { - case $PACKAGER in + case "$PACKAGER" in dnf) printf "%b\n" ${YELLOW}"Installing virtualization tools...${RC}" - $ESCALATION_TOOL "$PACKAGER" install -y @virtualization + "$ESCALATION_TOOL" "$PACKAGER" install -y @virtualization printf "%b\n" "${GREEN}Installed virtualization tools...${RC}" ;; *) diff --git a/tabs/system-setup/system-cleanup.sh b/tabs/system-setup/system-cleanup.sh index 625bc5bf4..40d5be2a4 100644 --- a/tabs/system-setup/system-cleanup.sh +++ b/tabs/system-setup/system-cleanup.sh @@ -26,7 +26,7 @@ cleanup_system() { "$ESCALATION_TOOL" "$PACKAGER" -Rns "$(pacman -Qtdq)" --noconfirm ;; *) - printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" return 1 ;; esac diff --git a/tabs/system-setup/system-update.sh b/tabs/system-setup/system-update.sh index 6bcaf99ae..521fd124d 100755 --- a/tabs/system-setup/system-update.sh +++ b/tabs/system-setup/system-update.sh @@ -56,7 +56,7 @@ fastUpdate() { "$ESCALATION_TOOL" "$PACKAGER" -Syu- ;; *) - printf "%b\n" "${RED}Unsupported package manager: $PACKAGER${RC}" + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" exit 1 ;; esac @@ -85,7 +85,7 @@ updateSystem() { "$ESCALATION_TOOL" "$PACKAGER" -Syu ;; *) - printf "%b\n" "${RED}Unsupported package manager: ${PACKAGER}${RC}" + printf "%b\n" "${RED}Unsupported package manager: "$PACKAGER"${RC}" exit 1 ;; esac diff --git a/tabs/utils/auto-login.sh b/tabs/utils/auto-login.sh index aa73211c5..b5ce0131b 100644 --- a/tabs/utils/auto-login.sh +++ b/tabs/utils/auto-login.sh @@ -44,9 +44,9 @@ configure_lightdm() { printf "Enter username for LightDM autologin: " read -r user - $ESCALATION_TOOL "printf '[Seat:*]' > /etc/lightdm/lightdm.conf.d/50-autologin.conf" - $ESCALATION_TOOL "printf 'autologin-user=$user' >> /etc/lightdm/lightdm.conf.d/50-autologin.conf" - $ESCALATION_TOOL "printf 'autologin-user-timeout=0' >> /etc/lightdm/lightdm.conf.d/50-autologin.conf" + "$ESCALATION_TOOL" "printf '[Seat:*]' > /etc/lightdm/lightdm.conf.d/50-autologin.conf" + "$ESCALATION_TOOL" "printf 'autologin-user=$user' >> /etc/lightdm/lightdm.conf.d/50-autologin.conf" + "$ESCALATION_TOOL" "printf 'autologin-user-timeout=0' >> /etc/lightdm/lightdm.conf.d/50-autologin.conf" printf "LightDM has been configured for autologin.\n" } @@ -54,7 +54,7 @@ configure_lightdm() { # Function to remove LightDM autologin remove_lightdm_autologin() { printf "Removing LightDM autologin configuration...\n" - $ESCALATION_TOOL rm -f /etc/lightdm/lightdm.conf.d/50-autologin.conf + "$ESCALATION_TOOL" rm -f /etc/lightdm/lightdm.conf.d/50-autologin.conf printf "LightDM autologin configuration has been removed.\n" } @@ -65,9 +65,9 @@ configure_gdm() { printf "Enter username for GDM autologin: " read -r user - $ESCALATION_TOOL "printf '[daemon]' > /etc/gdm/custom.conf" - $ESCALATION_TOOL "printf 'AutomaticLoginEnable = true' >> /etc/gdm/custom.conf" - $ESCALATION_TOOL "printf 'AutomaticLogin = $user' >> /etc/gdm/custom.conf" + "$ESCALATION_TOOL" "printf '[daemon]' > /etc/gdm/custom.conf" + "$ESCALATION_TOOL" "printf 'AutomaticLoginEnable = true' >> /etc/gdm/custom.conf" + "$ESCALATION_TOOL" "printf 'AutomaticLogin = $user' >> /etc/gdm/custom.conf" printf "GDM has been configured for autologin.\n" } @@ -75,8 +75,8 @@ configure_gdm() { # Function to remove GDM autologin remove_gdm_autologin() { printf "Removing GDM autologin configuration...\n" - $ESCALATION_TOOL sed -i '/AutomaticLoginEnable/d' /etc/gdm/custom.conf - $ESCALATION_TOOL sed -i '/AutomaticLogin/d' /etc/gdm/custom.conf + "$ESCALATION_TOOL" sed -i '/AutomaticLoginEnable/d' /etc/gdm/custom.conf + "$ESCALATION_TOOL" sed -i '/AutomaticLogin/d' /etc/gdm/custom.conf printf "GDM autologin configuration has been removed.\n" } @@ -88,9 +88,9 @@ configure_sddm() { read -r user list_sessions # Show session options - $ESCALATION_TOOL "printf '[Autologin]' > /etc/sddm.conf" - $ESCALATION_TOOL "printf 'User=$user' >> /etc/sddm.conf" - $ESCALATION_TOOL "printf 'Session=$session' >> /etc/sddm.conf" + "$ESCALATION_TOOL" "printf '[Autologin]' > /etc/sddm.conf" + "$ESCALATION_TOOL" "printf 'User=$user' >> /etc/sddm.conf" + "$ESCALATION_TOOL" "printf 'Session=$session' >> /etc/sddm.conf" printf "SDDM has been configured for autologin.\n" } @@ -98,7 +98,7 @@ configure_sddm() { # Function to remove SDDM autologin remove_sddm_autologin() { printf "Removing SDDM autologin configuration...\n" - $ESCALATION_TOOL sed -i '/\[Autologin\]/,+2d' /etc/sddm.conf + "$ESCALATION_TOOL" sed -i '/\[Autologin\]/,+2d' /etc/sddm.conf printf "SDDM autologin configuration has been removed.\n" } @@ -110,8 +110,8 @@ configure_lxdm() { read -r user list_sessions # Show session options - $ESCALATION_TOOL sed -i "s/^#.*autologin=.*$/autologin=${user}/" /etc/lxdm/lxdm.conf - $ESCALATION_TOOL sed -i "s|^#.*session=.*$|session=/usr/bin/${session}|; s|^session=.*$|session=/usr/bin/${session}|" /etc/lxdm/lxdm.conf + "$ESCALATION_TOOL" sed -i "s/^#.*autologin=.*$/autologin=${user}/" /etc/lxdm/lxdm.conf + "$ESCALATION_TOOL" sed -i "s|^#.*session=.*$|session=/usr/bin/${session}|; s|^session=.*$|session=/usr/bin/${session}|" /etc/lxdm/lxdm.conf printf "LXDM has been configured for autologin.\n" } @@ -119,8 +119,8 @@ configure_lxdm() { # Function to remove LXDM autologin remove_lxdm_autologin() { printf "Removing LXDM autologin configuration...\n" - $ESCALATION_TOOL sed -i "s/^autologin=.*$/#autologin=/" /etc/lxdm/lxdm.conf - $ESCALATION_TOOL sed -i "s/^session=.*$/#session=/" /etc/lxdm/lxdm.conf + "$ESCALATION_TOOL" sed -i "s/^autologin=.*$/#autologin=/" /etc/lxdm/lxdm.conf + "$ESCALATION_TOOL" sed -i "s/^session=.*$/#session=/" /etc/lxdm/lxdm.conf printf "LXDM autologin configuration has been removed.\n" } diff --git a/tabs/utils/create-bootable-usb.sh b/tabs/utils/create-bootable-usb.sh index e96c73a93..17e422c24 100644 --- a/tabs/utils/create-bootable-usb.sh +++ b/tabs/utils/create-bootable-usb.sh @@ -13,7 +13,7 @@ usage() { list_devices() { printf "%b\n" "${YELLOW} Available devices and partitions: ${RC}" printf "\n" - $ESCALATION_TOOL lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL + "$ESCALATION_TOOL" lsblk -o NAME,FSTYPE,SIZE,MOUNTPOINT,LABEL printf "\n" } @@ -164,13 +164,13 @@ write_iso(){ # Display progress and create the bootable USB drive printf "%b\n" "${YELLOW}Creating bootable USB drive...${RC}" - if ! $ESCALATION_TOOL dd if="$ISO_PATH" of="$USB_DEVICE" bs=4M status=progress oflag=sync; then + if ! "$ESCALATION_TOOL" dd if="$ISO_PATH" of="$USB_DEVICE" bs=4M status=progress oflag=sync; then printf "%b\n" "${RED}Failed to create bootable USB drive${RC}" exit 1 fi # Sync to ensure all data is written - if ! $ESCALATION_TOOL sync; then + if ! "$ESCALATION_TOOL" sync; then printf "%b\n" "${RED}Failed to sync data${RC}" exit 1 fi @@ -179,10 +179,10 @@ write_iso(){ # Eject the USB device printf "%b\n" "${YELLOW}Ejecting ${USB_DEVICE}...${RC}" - if ! $ESCALATION_TOOL umount "${USB_DEVICE}"* 2>/dev/null; then + if ! "$ESCALATION_TOOL" umount "${USB_DEVICE}"* 2>/dev/null; then printf "%b\n" "${RED}Failed to unmount ${USB_DEVICE}${RC}" fi - if ! $ESCALATION_TOOL eject "$USB_DEVICE"; then + if ! "$ESCALATION_TOOL" eject "$USB_DEVICE"; then printf "%b\n" "${RED}Failed to eject ${USB_DEVICE}${RC}" fi diff --git a/tabs/utils/encrypt_decrypt_tool.sh b/tabs/utils/encrypt_decrypt_tool.sh index 805cd9116..8a4f033f4 100644 --- a/tabs/utils/encrypt_decrypt_tool.sh +++ b/tabs/utils/encrypt_decrypt_tool.sh @@ -6,18 +6,18 @@ printf "%b\n" "${YELLOW}Ensuring OpenSSL is installed...${RC}" # Install OpenSSL if ! command_exists openssl; then - case $PACKAGER in + case "$PACKAGER" in pacman) - $ESCALATION_TOOL ${PACKAGER} -Syu --noconfirm openssl + "$ESCALATION_TOOL" "$PACKAGER" -Syu --noconfirm openssl ;; apt-get) - $ESCALATION_TOOL ${PACKAGER} update && $ESCALATION_TOOL ${PACKAGER} install -y openssl + "$ESCALATION_TOOL" "$PACKAGER" update && "$ESCALATION_TOOL" "$PACKAGER" install -y openssl ;; dnf) - $ESCALATION_TOOL ${PACKAGER} install -y openssl + "$ESCALATION_TOOL" "$PACKAGER" install -y openssl ;; zypper) - $ESCALATION_TOOL ${PACKAGER} install openssl + "$ESCALATION_TOOL" "$PACKAGER" install openssl ;; *) printf "%b\n" "${RED}Your Linux distribution is not supported by this script.${RC}" diff --git a/tabs/utils/power-profile.sh b/tabs/utils/power-profile.sh index 3cc1823fc..4ab801331 100644 --- a/tabs/utils/power-profile.sh +++ b/tabs/utils/power-profile.sh @@ -15,12 +15,12 @@ installAutoCpufreq() { # Install git if not already installed if ! command_exists git; then printf "%b\n" "${YELLOW}git not found. Installing git...${RC}" - case ${PACKAGER} in + case "$PACKAGER" in pacman) - $ESCALATION_TOOL ${PACKAGER} -S --needed --noconfirm git + "$ESCALATION_TOOL" "$PACKAGER" -S --needed --noconfirm git ;; *) - $ESCALATION_TOOL ${PACKAGER} install -y git + "$ESCALATION_TOOL" "$PACKAGER" install -y git ;; esac fi @@ -31,11 +31,11 @@ installAutoCpufreq() { git clone https://github.com/AdnanHodzic/auto-cpufreq.git fi - case ${PACKAGER} in + case "$PACKAGER" in *) cd auto-cpufreq printf "%b\n" "${YELLOW}Running auto-cpufreq installer...${RC}" - $ESCALATION_TOOL ./auto-cpufreq-installer + "$ESCALATION_TOOL" ./auto-cpufreq-installer ;; esac cd .. @@ -49,10 +49,10 @@ configureAutoCpufreq() { # Check if the system has a battery to determine if it's a laptop if [ -d /sys/class/power_supply/BAT0 ]; then printf "%b\n" "${GREEN}System detected as laptop. Updating auto-cpufreq for laptop...${RC}" - $ESCALATION_TOOL auto-cpufreq --force powersave + "$ESCALATION_TOOL" auto-cpufreq --force powersave else printf "%b\n" "${GREEN}System detected as desktop. Updating auto-cpufreq for desktop...${RC}" - $ESCALATION_TOOL auto-cpufreq --force performance + "$ESCALATION_TOOL" auto-cpufreq --force performance fi else printf "%b\n" "${RED}auto-cpufreq is not installed, skipping configuration.${RC}" @@ -64,7 +64,7 @@ removeAutoCpufreqTweak() { if command_exists auto-cpufreq; then printf "%b\n" "${YELLOW}Resetting auto-cpufreq configuration...${RC}" - $ESCALATION_TOOL auto-cpufreq --force reset + "$ESCALATION_TOOL" auto-cpufreq --force reset else printf "%b\n" "${RED}auto-cpufreq is not installed, skipping removal.${RC}" fi diff --git a/tabs/utils/service-control.sh b/tabs/utils/service-control.sh index 119e45f31..4539f4448 100644 --- a/tabs/utils/service-control.sh +++ b/tabs/utils/service-control.sh @@ -92,11 +92,11 @@ add_service() { printf "\n" printf "[Install]\n" printf "WantedBy=multi-user.target\n" - } | $ESCALATION_TOOL tee "$SERVICE_FILE" > /dev/null + } | "$ESCALATION_TOOL" tee "$SERVICE_FILE" > /dev/null # Set permissions and reload systemd - $ESCALATION_TOOL chmod 644 "$SERVICE_FILE" - $ESCALATION_TOOL systemctl daemon-reload + "$ESCALATION_TOOL" chmod 644 "$SERVICE_FILE" + "$ESCALATION_TOOL" systemctl daemon-reload printf "Service $SERVICE_NAME has been created and is ready to be started.\n" # Optionally, enable and start the service @@ -121,12 +121,12 @@ remove_service() { if [ -f "$SERVICE_FILE" ]; then printf "Stopping and disabling the service...\n" - $ESCALATION_TOOL systemctl stop "$SERVICE_NAME" - $ESCALATION_TOOL systemctl disable "$SERVICE_NAME" + "$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME" + "$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME" printf "Removing the service file...\n" - $ESCALATION_TOOL rm -f "$SERVICE_FILE" - $ESCALATION_TOOL systemctl daemon-reload + "$ESCALATION_TOOL" rm -f "$SERVICE_FILE" + "$ESCALATION_TOOL" systemctl daemon-reload printf "Service $SERVICE_NAME has been removed.\n" else printf "Service $SERVICE_NAME does not exist.\n" @@ -139,7 +139,7 @@ start_service() { printf "Enter the name of the service to start (e.g., my_service):\n" read -r SERVICE_NAME - if $ESCALATION_TOOL systemctl start "$SERVICE_NAME"; then + if "$ESCALATION_TOOL" systemctl start "$SERVICE_NAME"; then printf "Service $SERVICE_NAME has been started.\n" else printf "Failed to start service: $SERVICE_NAME.\n" @@ -152,7 +152,7 @@ stop_service() { printf "Enter the name of the service to stop (e.g., my_service):\n" read -r SERVICE_NAME - if $ESCALATION_TOOL systemctl stop "$SERVICE_NAME"; then + if "$ESCALATION_TOOL" systemctl stop "$SERVICE_NAME"; then printf "Service $SERVICE_NAME has been stopped.\n" else printf "Failed to stop service: $SERVICE_NAME.\n" @@ -165,7 +165,7 @@ enable_service() { printf "Enter the name of the service to enable (e.g., my_service):\n" read -r SERVICE_NAME - if $ESCALATION_TOOL systemctl enable "$SERVICE_NAME"; then + if "$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME"; then printf "Service $SERVICE_NAME has been enabled.\n" else printf "Failed to enable service: $SERVICE_NAME.\n" @@ -178,7 +178,7 @@ disable_service() { printf "Enter the name of the service to disable (e.g., my_service):\n" read -r SERVICE_NAME - if $ESCALATION_TOOL systemctl disable "$SERVICE_NAME"; then + if "$ESCALATION_TOOL" systemctl disable "$SERVICE_NAME"; then printf "Service $SERVICE_NAME has been enabled.\n" else printf "Failed to enable service: $SERVICE_NAME.\n" @@ -228,8 +228,8 @@ create_service_from_external() { "$ESCALATION_TOOL" cp "$SERVICE_FILE" "$SYSTEMD_SERVICE_FILE" # Set permissions and reload systemd - $ESCALATION_TOOL chmod 644 "$SYSTEMD_SERVICE_FILE" - $ESCALATION_TOOL systemctl daemon-reload + "$ESCALATION_TOOL" chmod 644 "$SYSTEMD_SERVICE_FILE" + "$ESCALATION_TOOL" systemctl daemon-reload printf "Service $SERVICE_NAME has been created and is ready to be started.\n" # Optionally, enable and start the service @@ -237,8 +237,8 @@ create_service_from_external() { read -r START_ENABLE if [ "$START_ENABLE" = "y" ]; then - $ESCALATION_TOOL systemctl start "$SERVICE_NAME" - $ESCALATION_TOOL systemctl enable "$SERVICE_NAME" + "$ESCALATION_TOOL" systemctl start "$SERVICE_NAME" + "$ESCALATION_TOOL" systemctl enable "$SERVICE_NAME" printf "Service $SERVICE_NAME has been started and enabled.\n" else printf "Service $SERVICE_NAME has been created but not started.\n" diff --git a/tabs/utils/ssh.sh b/tabs/utils/ssh.sh index c25f69a30..98b8715ce 100644 --- a/tabs/utils/ssh.sh +++ b/tabs/utils/ssh.sh @@ -59,11 +59,11 @@ disable_password_auth() { read -r host_alias printf "%b\n" ssh $host_alias " - $ESCALATION_TOOL -S sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && - $ESCALATION_TOOL -S sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && - $ESCALATION_TOOL -S sed -i 's/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config && - $ESCALATION_TOOL -S sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config && - $ESCALATION_TOOL -S systemctl restart sshd + "$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && + "$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config && + "$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config && + "$ESCALATION_TOOL" -S sed -i 's/^PubkeyAuthentication no/PubkeyAuthentication yes/' /etc/ssh/sshd_config && + "$ESCALATION_TOOL" -S systemctl restart sshd " printf "%b\n" "PasswordAuthentication set to no and PubkeyAuthentication set to yes." } @@ -74,11 +74,11 @@ enable_password_auth() { read -r host_alias printf "\n" ssh $host_alias " - $ESCALATION_TOOL -S sed -i 's/^#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config && - $ESCALATION_TOOL -S sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config && - $ESCALATION_TOOL -S sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config && - $ESCALATION_TOOL -S sed -i 's/^PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config && - $ESCALATION_TOOL -S systemctl restart sshd + "$ESCALATION_TOOL" -S sed -i 's/^#PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config && + "$ESCALATION_TOOL" -S sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config && + "$ESCALATION_TOOL" -S sed -i 's/^#PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config && + "$ESCALATION_TOOL" -S sed -i 's/^PubkeyAuthentication yes/PubkeyAuthentication no/' /etc/ssh/sshd_config && + "$ESCALATION_TOOL" -S systemctl restart sshd " printf "%b\n" "PasswordAuthentication set to yes and PubkeyAuthentication set to no." } diff --git a/tabs/utils/timeshift.sh b/tabs/utils/timeshift.sh index ec69081f2..4b47debfb 100644 --- a/tabs/utils/timeshift.sh +++ b/tabs/utils/timeshift.sh @@ -8,12 +8,12 @@ install_timeshift() { printf "%b\n" "${YELLOW}Checking if Timeshift is installed...${RC}" if ! command_exists timeshift; then - case ${PACKAGER} in + case "$PACKAGER" in pacman) - $ESCALATION_TOOL "${PACKAGER}" -S --noconfirm timeshift + "$ESCALATION_TOOL" "${PACKAGER}" -S --noconfirm timeshift ;; *) - $ESCALATION_TOOL "${PACKAGER}" install -y timeshift + "$ESCALATION_TOOL" "${PACKAGER}" install -y timeshift ;; esac else @@ -37,13 +37,13 @@ display_menu() { # Function to list snapshots list_snapshots() { printf "%b\n" "${CYAN}Listing snapshots...${RC}" - $ESCALATION_TOOL timeshift --list-snapshots + "$ESCALATION_TOOL" timeshift --list-snapshots } # Function to list devices list_devices() { printf "%b\n" "${CYAN}Listing available devices...${RC}" - $ESCALATION_TOOL timeshift --list-devices + "$ESCALATION_TOOL" timeshift --list-devices } # Function to create a new snapshot @@ -55,13 +55,13 @@ create_snapshot() { if [ -z "$COMMENT" ] && [ -z "$TAG" ]; then printf "%b\n" "${CYAN}Creating snapshot with no comment or tag...${RC}" - $ESCALATION_TOOL timeshift --create + "$ESCALATION_TOOL" timeshift --create elif [ -z "$TAG" ]; then printf "%b\n" "${CYAN}Creating snapshot with no tag...${RC}" - $ESCALATION_TOOL timeshift --create --comments "$COMMENT" + "$ESCALATION_TOOL" timeshift --create --comments "$COMMENT" else printf "%b\n" "${CYAN}Creating snapshot with tag: $TAG...${RC}" - $ESCALATION_TOOL timeshift --create --comments "$COMMENT" --tags "$TAG" + "$ESCALATION_TOOL" timeshift --create --comments "$COMMENT" --tags "$TAG" fi if [ $? -eq 0 ]; then @@ -83,11 +83,11 @@ restore_snapshot() { read -r SKIP_GRUB if [ "$SKIP_GRUB" = "yes" ]; then - $ESCALATION_TOOL timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --skip-grub --yes + "$ESCALATION_TOOL" timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --skip-grub --yes else printf "%b\n" "${CYAN}Enter GRUB device (e.g., /dev/sda): ${RC}" read -r GRUB_DEVICE - $ESCALATION_TOOL timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --grub-device "$GRUB_DEVICE" --yes + "$ESCALATION_TOOL" timeshift --restore --snapshot "$SNAPSHOT" --target-device "$TARGET_DEVICE" --grub-device "$GRUB_DEVICE" --yes fi if [ $? -eq 0 ]; then @@ -105,7 +105,7 @@ delete_snapshot() { read -r SNAPSHOT printf "%b\n" "${YELLOW}Deleting snapshot $SNAPSHOT...${RC}" - $ESCALATION_TOOL timeshift --delete --snapshot "$SNAPSHOT" --yes + "$ESCALATION_TOOL" timeshift --delete --snapshot "$SNAPSHOT" --yes if [ $? -eq 0 ]; then printf "%b\n" "${GREEN}Snapshot deleted successfully.${RC}" @@ -122,7 +122,7 @@ delete_all_snapshots() { if [ "$CONFIRMATION" = "yes" ]; then printf "%b\n" "${CYAN}Deleting all snapshots...${RC}" - $ESCALATION_TOOL timeshift --delete-all --yes + "$ESCALATION_TOOL" timeshift --delete-all --yes if [ $? -eq 0 ]; then printf "%b\n" "${GREEN}All snapshots deleted successfully.${RC}" else diff --git a/tabs/utils/user-account-manager/add_to_group.sh b/tabs/utils/user-account-manager/add_to_group.sh index 8ef22c20e..bc66da1b4 100755 --- a/tabs/utils/user-account-manager/add_to_group.sh +++ b/tabs/utils/user-account-manager/add_to_group.sh @@ -18,7 +18,8 @@ available_groups=$(cut -d: -f1 /etc/group | sort | tr '\n' ' ') printf "%b\n" "${YELLOW}Available groups:${RC} $available_groups" printf "%b\n" "${YELLOW}=================${RC}" -read -p "Enter the groups you want to add user $username to (space-separated): " groups +printf "%b\n" "${YELLOW}Enter the groups you want to add user $username to (space-separated):${RC} " +read -r groups checkEmpty "$groups" || exit 1 checkGroupAvailabe "$groups" "$available_groups" || exit 1 diff --git a/tabs/utils/user-account-manager/add_user.sh b/tabs/utils/user-account-manager/add_user.sh index 83f31ca44..d26dbfc65 100755 --- a/tabs/utils/user-account-manager/add_user.sh +++ b/tabs/utils/user-account-manager/add_user.sh @@ -18,7 +18,7 @@ fi password=$(promptPassword) || exit 1 $ESCALATION_TOOL useradd -m "$username" -g users -s /bin/bash -echo "$username:$password" | $ESCALATION_TOOL chpasswd +echo "$username:$password" | "$ESCALATION_TOOL" chpasswd printf "%b\n" "${GREEN}User $username created successfully${RC}" printf "%b\n" "${GREEN}To add additional groups use Add User To Groups${RC}" diff --git a/tabs/utils/user-account-manager/change_password.sh b/tabs/utils/user-account-manager/change_password.sh index b7278cf73..677dcd759 100755 --- a/tabs/utils/user-account-manager/change_password.sh +++ b/tabs/utils/user-account-manager/change_password.sh @@ -14,7 +14,7 @@ printf "Are you sure you want to change password for $username? [Y/N]: " read -r confirm confirmAction || exit 1 -echo "$username:$password" | $ESCALATION_TOOL chpasswd +echo "$username:$password" | "$ESCALATION_TOOL" chpasswd printf "%b\n" "${GREEN}Password changed successfully${RC}" checkEnv \ No newline at end of file diff --git a/tabs/utils/user-account-manager/remove_from_group.sh b/tabs/utils/user-account-manager/remove_from_group.sh index c462e9d0b..f56a5d9e3 100755 --- a/tabs/utils/user-account-manager/remove_from_group.sh +++ b/tabs/utils/user-account-manager/remove_from_group.sh @@ -13,7 +13,8 @@ user_groups=$(groups "$username" | cut -d: -f2 | sort | tr '\n' ' ') printf "%b\n" "${YELLOW}Groups user $username is in:${RC} $user_groups" printf "%b\n" "${YELLOW}=================${RC}" -read -p "Enter the groups you want to remove user from $username (space-separated): " groups +printf "%b\n" "${YELLOW}Enter the groups you want to remove user $username from (space-separated):${RC} " +read -r groups checkEmpty "$groups" || exit 1 checkGroupAvailabe "$groups" "$user_groups" || exit 1