Skip to content

Commit

Permalink
Fix read problems
Browse files Browse the repository at this point in the history
  • Loading branch information
nnyyxxxx committed Sep 19, 2024
1 parent f0e8861 commit 5347dbc
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions tabs/applications-setup/setup-flatpak.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ setup_flatpak() {
if command -v flatpak >/dev/null 2>&1; then
if ! flatpak remotes | grep -q "flathub"; then
printf "%b\n" "${YELLOW}Detected Flatpak package manager but Flathub remote is not added. Would you like to add it? (y/n)${RC}"
read add_remote
read -r add_remote
case "$add_remote" in
[Yy]*)
printf "%b\n" "Adding Flathub remote..."
Expand All @@ -71,14 +71,14 @@ setup_flatpak() {
# So in case the user wants to use a GUI siftware manager they can setup it here
if [ "$DE" = "GNOME" ]; then
printf "%b\n" "${YELLOW}Detected GNOME desktop environment. Would you like to install GNOME Software plugin for Flatpak? (y/n)${RC}"
read install_gnome
read -r install_gnome
if [ "$install_gnome" = "y" ] || [ "$install_gnome" = "Y" ]; then
"$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
read -r install_kde
if [ "$install_kde" = "y" ] || [ "$install_kde" = "Y" ]; then
"$ESCALATION_TOOL" "$PACKAGER" install -y plasma-discover-backend-flatpak
fi
Expand Down
8 changes: 4 additions & 4 deletions tabs/utils/auto-login.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ list_sessions() {
printf "9) i3 (i3.desktop)\n"
printf "10) Custom session\n"
printf "Enter your choice [1-10]: "
read session_choice
read -r session_choice

case "$session_choice" in
1) session="gnome.desktop" ;;
Expand Down Expand Up @@ -130,7 +130,7 @@ configure_or_remove_autologin() {
printf "1) Add autologin\n"
printf "2) Remove autologin\n"
printf "Enter your choice [1-2]: "
read action_choice
read -r action_choice

if [ "$action_choice" = "1" ]; then
printf "Choose the display manager to configure:\n"
Expand All @@ -139,7 +139,7 @@ configure_or_remove_autologin() {
printf "3) SDDM\n"
printf "4) LXDM\n"
printf "Enter your choice [1-4]: "
read choice
read -r choice

case "$choice" in
1) configure_lightdm ;;
Expand All @@ -155,7 +155,7 @@ configure_or_remove_autologin() {
printf "3) SDDM\n"
printf "4) LXDM\n"
printf "Enter your choice [1-4]: "
read choice
read -r choice

case "$choice" in
1) remove_lightdm_autologin ;;
Expand Down
2 changes: 1 addition & 1 deletion tabs/utils/bluetooth-control.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ prompt_for_mac() {
done
printf "0. Exit to main menu\n"
printf "%s\n" "$prompt_msg"
read choice
read -r choice

# Validate the choice
if echo "$choice" | grep -qE '^[0-9]+$' && [ "$choice" -le "$((i - 1))" ] && [ "$choice" -gt 0 ]; then
Expand Down
10 changes: 5 additions & 5 deletions tabs/utils/monitor-control/set_brightness.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ adjust_monitor_brightness() {
done

printf "Enter the number of the monitor (or 'q' to quit): "
read monitor_choice
read -r monitor_choice

if [ "$monitor_choice" = "q" ]; then
printf "%b\n" "${RED}Exiting...${RC}"
Expand All @@ -31,14 +31,14 @@ adjust_monitor_brightness() {
if ! echo "$monitor_choice" | grep -qE '^[0-9]+$'; then
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
printf "Press [Enter] to continue..."
read dummy
read -r dummy
continue
fi

if [ "$monitor_choice" -lt 1 ] || [ "$monitor_choice" -gt "$#" ]; then
printf "%b\n" "${RED}Invalid selection. Please try again.${RC}"
printf "Press [Enter] to continue..."
read dummy
read -r dummy
continue
fi

Expand All @@ -51,7 +51,7 @@ adjust_monitor_brightness() {

while true; do
printf "Enter the new brightness value as a percentage (10 to 100, or 'q' to quit): "
read new_brightness_percentage
read -r new_brightness_percentage

if [ "$new_brightness_percentage" = "q" ]; then
printf "%b\n" "${RED}Exiting...${RC}"
Expand All @@ -68,7 +68,7 @@ adjust_monitor_brightness() {
new_brightness=$(awk "BEGIN {printf \"%.2f\", $new_brightness_percentage / 100}")

printf "Set brightness for $monitor_name to $new_brightness_percentage%? (y/n): "
read confirm
read -r confirm
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
printf "%b\n" "${GREEN}Setting brightness for $monitor_name to $new_brightness_percentage%${RC}"
execute_command "xrandr --output $monitor_name --brightness $new_brightness"
Expand Down
2 changes: 1 addition & 1 deletion tabs/utils/ssh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ show_menu() {
main() {
while true; do
show_menu
read choice
read -r choice
case $choice in
1) ask_for_host_details ;;
2) show_available_hosts && printf "%b\n" "Enter the alias of the host to connect to: " && read -r host_alias; ssh $host_alias ;;
Expand Down
2 changes: 1 addition & 1 deletion tabs/utils/user-account-manager/delete_user.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ username=$(promptUsername "" "non-root") || exit 1
if [ "$username" = "$USER" ]; then
printf "%b\n" "${RED}Cannot delete the current user${RC}"
printf "%b\n" "${RED}Press [Enter] to continue...${RC}"
read dummy
read -r dummy
return
fi

Expand Down
6 changes: 3 additions & 3 deletions tabs/utils/wifi-control.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ main_menu() {
printf "6. Remove a WiFi connection\n"
printf "0. Exit\n"
printf "Choose an option: "
read choice
read -r choice

case $choice in
1) wifi_on ;;
Expand Down Expand Up @@ -132,13 +132,13 @@ prompt_for_network() {

printf "0. Exit to main menu\n"
printf "%s" "$prompt_msg"
read choice
read -r choice

if [ "$choice" -ge 1 ] && [ "$choice" -lt "$i" ]; then
ssid=$(sed -n "${choice}p" "$temp_file" | awk -F: '{print $1}')
if [ "$action" = "connect" ]; then
printf "Enter password for SSID %s: " "$ssid"
read password
read -r password
printf "\n"
nmcli dev wifi connect "$ssid" password "$password" && {
printf "%b\n" "${GREEN}$success_msg${RC}"
Expand Down

0 comments on commit 5347dbc

Please sign in to comment.