mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-22 05:12:27 +00:00
Fix read problems (#546)
Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com>
This commit is contained in:
parent
de98efbb8b
commit
56233e436d
|
@ -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..."
|
||||
|
@ -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
|
||||
|
|
|
@ -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" ;;
|
||||
|
@ -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"
|
||||
|
@ -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 ;;
|
||||
|
@ -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 ;;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}"
|
||||
|
@ -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
|
||||
|
||||
|
@ -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}"
|
||||
|
@ -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"
|
||||
|
|
|
@ -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 ;;
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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 ;;
|
||||
|
@ -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}"
|
||||
|
|
Loading…
Reference in New Issue
Block a user